1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00
This commit is contained in:
Leonid Fedorov
2022-11-09 22:41:38 +00:00
parent f4e3022fbd
commit 37fd915a08
31 changed files with 63 additions and 114 deletions

View File

@ -508,67 +508,3 @@ void cpsm_conhdl_t::write(ByteStream bs)
} // namespace sm
/**
* The following functions exist because QueryStats is used by sm.
* QueryStats needs to use a MariaDB client connection and has to use the
* server's built-in client which doesn't have the same API as the general
* MariaDB client.
* These functions reproduce the missing functionality.
* Everywhere else QueryStats is linked to uses the general MariaDB API so
* these functions aren't needed.
*/
unsigned long mysql_real_escape_string(MYSQL* mysql, char* to, const char* from, unsigned long length)
{
my_bool overflow;
return escape_string_for_mysql(mysql->charset, to, length * 2 + 1, from, length, &overflow);
}
// Clone of sql-common/client.c cli_use_result
MYSQL_RES* mysql_use_result(MYSQL* mysql)
{
MYSQL_RES* result;
DBUG_ENTER("mysql_use_result (clone)");
if (!mysql->fields)
DBUG_RETURN(0);
if (mysql->status != MYSQL_STATUS_GET_RESULT)
{
set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
DBUG_RETURN(0);
}
if (!(result =
(MYSQL_RES*)my_malloc(PSI_NOT_INSTRUMENTED, sizeof(*result) + sizeof(ulong) * mysql->field_count,
MYF(MY_WME | MY_ZEROFILL))))
DBUG_RETURN(0);
result->lengths = (ulong*)(result + 1);
result->methods = mysql->methods;
if (!(result->row = (MYSQL_ROW)my_malloc(PSI_NOT_INSTRUMENTED,
sizeof(result->row[0]) * (mysql->field_count + 1), MYF(MY_WME))))
{
/* Ptrs: to one row */
my_free(result);
DBUG_RETURN(0);
}
result->fields = mysql->fields;
result->field_alloc = mysql->field_alloc;
result->field_count = mysql->field_count;
result->current_field = 0;
result->handle = mysql;
result->current_row = 0;
mysql->fields = 0; /* fields is now in result */
clear_alloc_root(&mysql->field_alloc);
mysql->status = MYSQL_STATUS_USE_RESULT;
mysql->unbuffered_fetch_owner = &result->unbuffered_fetch_cancelled;
DBUG_RETURN(result); /* Data is read to be fetched */
}
MYSQL_FIELD* mysql_fetch_fields(MYSQL_RES* res)
{
return res->fields;
}