more C API methods in the service_sql

for columnstore
This commit is contained in:
Sergei Golubchik 2022-11-14 20:46:42 +01:00
parent 47e29a2ff4
commit d5e3d37ec2
13 changed files with 86 additions and 24 deletions

View file

@ -37,16 +37,19 @@
#define mysql_free_result MARIADB_ADD_PREFIX(mysql_free_result)
#define mysql_get_socket MARIADB_ADD_PREFIX(mysql_get_socket)
#define mysql_set_character_set MARIADB_ADD_PREFIX(mysql_set_character_set)
#define mysql_real_escape_string MARIADB_ADD_PREFIX(mysql_real_escape_string)
#define mysql_get_server_version MARIADB_ADD_PREFIX(mysql_get_server_version)
#define mysql_error MARIADB_ADD_PREFIX(mysql_error)
#define mysql_errno MARIADB_ADD_PREFIX(mysql_errno)
#define mysql_num_fields MARIADB_ADD_PREFIX(mysql_num_fields)
#define mysql_num_rows MARIADB_ADD_PREFIX(mysql_num_rows)
#define mysql_options4 MARIADB_ADD_PREFIX(mysql_options4)
#define mysql_fetch_fields MARIADB_ADD_PREFIX(mysql_fetch_fields)
#define mysql_fetch_lengths MARIADB_ADD_PREFIX(mysql_fetch_lengths)
#define mysql_fetch_row MARIADB_ADD_PREFIX(mysql_fetch_row)
#define mysql_affected_rows MARIADB_ADD_PREFIX(mysql_affected_rows)
#define mysql_store_result MARIADB_ADD_PREFIX(mysql_store_result)
#define mysql_use_result MARIADB_ADD_PREFIX(mysql_use_result)
#define mysql_select_db MARIADB_ADD_PREFIX(mysql_select_db)
#define mysql_get_ssl_cipher MARIADB_ADD_PREFIX(mysql_get_ssl_cipher)
#define mysql_ssl_set MARIADB_ADD_PREFIX(mysql_ssl_set)

View file

@ -487,6 +487,12 @@ extern struct sql_service_st {
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
MYSQL_RES *(STDCALL *mysql_use_result_func)(MYSQL *mysql);
MYSQL_FIELD *(STDCALL *mysql_fetch_fields_func)(MYSQL_RES *res);
unsigned long (STDCALL *mysql_real_escape_string_func)(MYSQL *mysql, char *to,
const char *from, unsigned long length);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca, const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}

View file

@ -487,6 +487,12 @@ extern struct sql_service_st {
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
MYSQL_RES *(STDCALL *mysql_use_result_func)(MYSQL *mysql);
MYSQL_FIELD *(STDCALL *mysql_fetch_fields_func)(MYSQL_RES *res);
unsigned long (STDCALL *mysql_real_escape_string_func)(MYSQL *mysql, char *to,
const char *from, unsigned long length);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca, const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}

View file

@ -487,6 +487,12 @@ extern struct sql_service_st {
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
MYSQL_RES *(STDCALL *mysql_use_result_func)(MYSQL *mysql);
MYSQL_FIELD *(STDCALL *mysql_fetch_fields_func)(MYSQL_RES *res);
unsigned long (STDCALL *mysql_real_escape_string_func)(MYSQL *mysql, char *to,
const char *from, unsigned long length);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca, const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}

View file

@ -487,6 +487,12 @@ extern struct sql_service_st {
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
MYSQL_RES *(STDCALL *mysql_use_result_func)(MYSQL *mysql);
MYSQL_FIELD *(STDCALL *mysql_fetch_fields_func)(MYSQL_RES *res);
unsigned long (STDCALL *mysql_real_escape_string_func)(MYSQL *mysql, char *to,
const char *from, unsigned long length);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca, const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}

View file

@ -487,6 +487,12 @@ extern struct sql_service_st {
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
MYSQL_RES *(STDCALL *mysql_use_result_func)(MYSQL *mysql);
MYSQL_FIELD *(STDCALL *mysql_fetch_fields_func)(MYSQL_RES *res);
unsigned long (STDCALL *mysql_real_escape_string_func)(MYSQL *mysql, char *to,
const char *from, unsigned long length);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca, const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}

View file

@ -487,6 +487,12 @@ extern struct sql_service_st {
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
MYSQL_RES *(STDCALL *mysql_use_result_func)(MYSQL *mysql);
MYSQL_FIELD *(STDCALL *mysql_fetch_fields_func)(MYSQL_RES *res);
unsigned long (STDCALL *mysql_real_escape_string_func)(MYSQL *mysql, char *to,
const char *from, unsigned long length);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca, const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}

View file

@ -487,6 +487,12 @@ extern struct sql_service_st {
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
MYSQL_RES *(STDCALL *mysql_use_result_func)(MYSQL *mysql);
MYSQL_FIELD *(STDCALL *mysql_fetch_fields_func)(MYSQL_RES *res);
unsigned long (STDCALL *mysql_real_escape_string_func)(MYSQL *mysql, char *to,
const char *from, unsigned long length);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca, const char *capath, const char *cipher);
} *sql_service;
MYSQL *mysql_real_connect_local(MYSQL *mysql);
}

View file

@ -68,6 +68,12 @@ extern struct sql_service_st {
int (STDCALL *mysql_set_character_set_func)(MYSQL *mysql, const char *cs_name);
unsigned int (STDCALL *mysql_num_fields_func)(MYSQL_RES *res);
int (STDCALL *mysql_select_db_func)(MYSQL *mysql, const char *db);
MYSQL_RES *(STDCALL *mysql_use_result_func)(MYSQL *mysql);
MYSQL_FIELD *(STDCALL *mysql_fetch_fields_func)(MYSQL_RES *res);
unsigned long (STDCALL *mysql_real_escape_string_func)(MYSQL *mysql, char *to,
const char *from, unsigned long length);
my_bool (STDCALL *mysql_ssl_set_func)(MYSQL *mysql, const char *key,
const char *cert, const char *ca, const char *capath, const char *cipher);
} *sql_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
@ -89,6 +95,10 @@ extern struct sql_service_st {
#define mysql_set_character_set(M,C) sql_service->mysql_set_character_set_func(M,C)
#define mysql_num_fields(R) sql_service->mysql_num_fields_func(R)
#define mysql_select_db(M,D) sql_service->mysql_select_db_func(M,D)
#define mysql_use_result(M) sql_service->mysql_use_result_func(M)
#define mysql_fetch_fields(R) sql_service->mysql_fetch_fields_func(R)
#define mysql_real_escape_string(M,T,F,L) sql_service->mysql_real_escape_string_func(M,T,F,L)
#define mysql_ssl_set(M,K,C1,C2,C3,C4) sql_service->mysql_ssl_set_func(M,K,C1,C2,C3,C4)
#else

View file

@ -44,7 +44,7 @@
#define VERSION_wsrep 0x0500
#define VERSION_json 0x0100
#define VERSION_thd_mdl 0x0100
#define VERSION_sql_service 0x0101
#define VERSION_sql_service 0x0102
#define VERSION_provider_bzip2 0x0100
#define VERSION_provider_lz4 0x0100

View file

@ -1065,11 +1065,6 @@ MYSQL_FIELD * STDCALL mysql_fetch_field_direct(MYSQL_RES *res,uint fieldnr)
return &(res)->fields[fieldnr];
}
MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res)
{
return (res)->fields;
}
MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res)
{
return res->data_cursor;
@ -1215,18 +1210,6 @@ mysql_escape_string(char *to,const char *from,ulong length)
length, &overflow);
}
ulong STDCALL
mysql_real_escape_string(MYSQL *mysql, char *to,const char *from,
ulong length)
{
my_bool overflow;
if (mysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)
return (ulong) escape_quotes_for_mysql(mysql->charset, to, 0, from, length,
&overflow);
return (ulong) escape_string_for_mysql(mysql->charset, to, 0, from, length,
&overflow);
}
void STDCALL
myodbc_remove_escape(MYSQL *mysql,char *name)
{
@ -4953,11 +4936,6 @@ int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt)
}
MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql)
{
return (*mysql->methods->use_result)(mysql);
}
my_bool STDCALL mysql_read_query_result(MYSQL *mysql)
{
return (*mysql->methods->read_query_result)(mysql);

View file

@ -4233,3 +4233,28 @@ int STDCALL mysql_cancel(MYSQL *mysql)
return vio_shutdown(mysql->net.vio, SHUT_RDWR);
return -1;
}
MYSQL_RES *STDCALL mysql_use_result(MYSQL *mysql)
{
return (*mysql->methods->use_result)(mysql);
}
MYSQL_FIELD *STDCALL mysql_fetch_fields(MYSQL_RES *res)
{
return (res)->fields;
}
ulong STDCALL
mysql_real_escape_string(MYSQL *mysql, char *to,const char *from,
ulong length)
{
my_bool overflow;
if (mysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)
return (ulong) escape_quotes_for_mysql(mysql->charset, to, 0, from, length,
&overflow);
return (ulong) escape_string_for_mysql(mysql->charset, to, 0, from, length,
&overflow);
}

View file

@ -251,7 +251,11 @@ struct sql_service_st sql_service_handler=
mysql_fetch_lengths,
mysql_set_character_set,
mysql_num_fields,
mysql_select_db
mysql_select_db,
mysql_use_result,
mysql_fetch_fields,
mysql_real_escape_string,
mysql_ssl_set
};
#define DEFINE_warning_function(name, ret) { \