1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-05 13:16:09 +03:00

MDEV-27595 Backport SQL service, introduced by MDEV-19275.

The SQL SERVICE backported into the 10.4.
This commit is contained in:
Alexey Botchkov
2022-07-24 00:40:06 +04:00
parent f0fe23566b
commit 1fa196a559
30 changed files with 1843 additions and 413 deletions

View File

@@ -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;
}
}
@@ -431,7 +431,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);
@@ -454,12 +454,25 @@ 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,
@@ -469,12 +482,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