You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
fix C API includes
ColumnStore used to include server's mysql.h but link all tools with libmariadb.so There's no guarantee that this would work, even with workarounds it had in dbcon/mysql/sm.cpp Fix: * tools (linked with libmariadb.so) *must* include libmariadb's mysql.h * as a hack prevent service_thd_timezone.h from being loaded into tools, as it conflicts with libmariadb's mysql.h * server plugin *must* include server's mysql.h * also don't link every tool with libmariadb.so, link the helper library (liblibmysqlclient.so) that actually needs it, tools use this helper library, not libmariadb.so directly
This commit is contained in:
@ -506,69 +506,4 @@ void cpsm_conhdl_t::write(ByteStream bs)
|
||||
#endif
|
||||
}
|
||||
|
||||
} // 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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user