diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2021-09-06 22:34:35 +0400 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2021-10-19 17:35:06 +0200 |
commit | 0a0dfd63d9a0ae5adb139159e0aeca93c5c2d5c9 (patch) | |
tree | 66209a932d5575a6c3021ab1d215c16e9a3bead7 /libmysqld | |
parent | 401ff6994d842a4072b7b155e5a958e178e6497a (diff) | |
download | mariadb-git-0a0dfd63d9a0ae5adb139159e0aeca93c5c2d5c9.tar.gz |
MDEV-19275 Provide SQL service to plugins.
SQL service added.
It provides the limited set of client library functions
to be used by plugin.
Diffstat (limited to 'libmysqld')
-rw-r--r-- | libmysqld/lib_sql.cc | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index a8f554326cd..db4e7e6cfa9 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -43,7 +43,7 @@ C_MODE_START extern unsigned int mysql_server_last_errno; extern char mysql_server_last_error[MYSQL_ERRMSG_SIZE]; static my_bool emb_read_query_result(MYSQL *mysql); -static void emb_free_embedded_thd(MYSQL *mysql); +static void free_embedded_thd(MYSQL *mysql); static bool embedded_print_errors= 0; extern "C" void unireg_clear(int exit_code) @@ -121,7 +121,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, thd->killed= NOT_KILLED; else { - emb_free_embedded_thd(mysql); + free_embedded_thd(mysql); thd= 0; } } @@ -430,7 +430,7 @@ int emb_unbuffered_fetch(MYSQL *mysql, char **row) return 0; } -static void emb_free_embedded_thd(MYSQL *mysql) +static void free_embedded_thd(MYSQL *mysql) { THD *thd= (THD*)mysql->thd; server_threads.erase(thd); @@ -453,12 +453,23 @@ static MYSQL_RES * emb_store_result(MYSQL *mysql) return mysql_store_result(mysql); } -int emb_read_change_user_result(MYSQL *mysql) +static int emb_read_change_user_result(MYSQL *mysql) { mysql->net.read_pos= (uchar*)""; // fake an OK packet return mysql_errno(mysql) ? (int)packet_error : 1 /* length of the OK packet */; } +static void emb_on_close_free(MYSQL *mysql) +{ + my_free(mysql->info_buffer); + mysql->info_buffer= 0; + if (mysql->thd) + { + free_embedded_thd(mysql); + mysql->thd= 0; + } +} + MYSQL_METHODS embedded_methods= { emb_read_query_result, @@ -468,12 +479,12 @@ MYSQL_METHODS embedded_methods= emb_fetch_lengths, emb_flush_use_result, emb_read_change_user_result, + emb_on_close_free, emb_list_fields, emb_read_prepare_result, emb_stmt_execute, emb_read_binary_rows, emb_unbuffered_fetch, - emb_free_embedded_thd, emb_read_statistics, emb_read_query_result, emb_read_rows_from_cursor |