Commit 15779a96 authored by unknown's avatar unknown

SCRUM

embedded library
some fixes - cleanup procedure changed for embedded library - deletion of
embedded mysql->thd


include/mysql.h:
  free_embedded_thd added to the list of virtual methods
libmysqld/embedded_priv.h:
  function deleted
libmysqld/lib_sql.cc:
  function moved upper in file
sql-common/client.c:
  call of free_embedded_thd added
parent 9a942c85
...@@ -564,8 +564,8 @@ typedef struct st_mysql_methods ...@@ -564,8 +564,8 @@ typedef struct st_mysql_methods
int (STDCALL *stmt_execute)(MYSQL_STMT *stmt); int (STDCALL *stmt_execute)(MYSQL_STMT *stmt);
MYSQL_DATA *(STDCALL *read_binary_rows)(MYSQL_STMT *stmt); MYSQL_DATA *(STDCALL *read_binary_rows)(MYSQL_STMT *stmt);
int (STDCALL *unbuffered_fetch)(MYSQL *mysql, char **row); int (STDCALL *unbuffered_fetch)(MYSQL *mysql, char **row);
void (STDCALL *free_embedded_thd)(MYSQL *mysql);
#endif #endif
} MYSQL_METHODS; } MYSQL_METHODS;
MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query, MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query,
......
...@@ -26,7 +26,6 @@ C_MODE_START ...@@ -26,7 +26,6 @@ C_MODE_START
extern void lib_connection_phase(NET *net, int phase); extern void lib_connection_phase(NET *net, int phase);
extern void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db); extern void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db);
extern void *create_embedded_thd(int client_flag, char *db); extern void *create_embedded_thd(int client_flag, char *db);
extern void free_embedded_thd(MYSQL *mysql);
extern MYSQL_METHODS embedded_methods; extern MYSQL_METHODS embedded_methods;
void free_old_query(MYSQL *mysql); void free_old_query(MYSQL *mysql);
extern my_bool server_inited; extern my_bool server_inited;
......
...@@ -210,6 +210,14 @@ int STDCALL emb_unbuffered_fetch(MYSQL *mysql, char **row) ...@@ -210,6 +210,14 @@ int STDCALL emb_unbuffered_fetch(MYSQL *mysql, char **row)
return 0; return 0;
} }
static void STDCALL emb_free_embedded_thd(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
if (thd->data)
free_rows(thd->data);
delete thd;
}
MYSQL_METHODS embedded_methods= MYSQL_METHODS embedded_methods=
{ {
emb_mysql_read_query_result, emb_mysql_read_query_result,
...@@ -221,7 +229,8 @@ MYSQL_METHODS embedded_methods= ...@@ -221,7 +229,8 @@ MYSQL_METHODS embedded_methods=
emb_read_prepare_result, emb_read_prepare_result,
emb_stmt_execute, emb_stmt_execute,
emb_read_binary_rows, emb_read_binary_rows,
emb_unbuffered_fetch emb_unbuffered_fetch,
emb_free_embedded_thd
}; };
C_MODE_END C_MODE_END
...@@ -493,16 +502,6 @@ err: ...@@ -493,16 +502,6 @@ err:
} }
#endif #endif
void free_embedded_thd(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
if (!thd)
return;
if (thd->data)
free_rows(thd->data);
delete thd;
}
C_MODE_END C_MODE_END
bool Protocol::send_fields(List<Item> *list, uint flag) bool Protocol::send_fields(List<Item> *list, uint flag)
......
...@@ -1409,7 +1409,8 @@ static MYSQL_METHODS client_methods= ...@@ -1409,7 +1409,8 @@ static MYSQL_METHODS client_methods=
cli_read_prepare_result, cli_read_prepare_result,
cli_stmt_execute, cli_stmt_execute,
cli_read_binary_rows, cli_read_binary_rows,
cli_unbuffered_fetch cli_unbuffered_fetch,
NULL
#endif #endif
}; };
...@@ -2207,6 +2208,10 @@ void STDCALL mysql_close(MYSQL *mysql) ...@@ -2207,6 +2208,10 @@ void STDCALL mysql_close(MYSQL *mysql)
#endif #endif
if (mysql != mysql->master) if (mysql != mysql->master)
mysql_close(mysql->master); mysql_close(mysql->master);
#ifndef MYSQL_SERVER
if (mysql->thd)
(*mysql->methods->free_embedded_thd)(mysql);
#endif
if (mysql->free_me) if (mysql->free_me)
my_free((gptr) mysql,MYF(0)); my_free((gptr) mysql,MYF(0));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment