From dc250a6efc8bc451b301c74b494200dfb3dd3f8b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 12 Sep 2003 19:35:34 +0500 Subject: SCRUM: #977 Prepared statements in embedded library include/mysql.h: read_prepare_result function moved to 'virtual' libmysql/client_settings.h: declare proper function for libmysql libmysql/libmysql.c: some code moved from implementation of read_prepare_result to mysql_prepare_result to make creating separate (remote and embedded-server) versions easier libmysqld/libmysqld.c: emb_read_prepare_result prototype sql-common/client.c: cli_read_prepare_result added to the client_methods sql/client_settings.h: we don't need prepared statements in mini_client sql/sql_prepare.cc: embedded send_prep_stmt added --- include/mysql.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/mysql.h') diff --git a/include/mysql.h b/include/mysql.h index ff00e75687d..f9adee6de04 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -556,6 +556,7 @@ typedef struct st_mysql_methods MYSQL_ROW column, uint field_count); MYSQL_RES * (STDCALL *list_fields)(MYSQL *mysql, const char *table, const char *wild); + my_bool (STDCALL *read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt); } MYSQL_METHODS; MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query, -- cgit v1.2.1 From d05807153b640bee039746cc449273e0672e43c4 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Sep 2003 16:06:25 +0500 Subject: SCRUM Prepared statements in embedded server Several changes in library code with two goals: to make mysql_prepare_stmt working in embedded server to get rid of #define mysql_interface_func mysql->methods->interface_func in user's interface include/mysql.h: modifications of interface two goals: to implement prepared statements and to get rid of #define mysql_proc (mysql->smth) in interface include/sql_common.h: read_rows function got 'virtual' libmysql/client_settings.h: interface of some functions declared in client.c moved here libmysql/libmysql.c: several functions changed with declared goals libmysqld/embedded_priv.h: libmysqld.c <--> lib_sql.cc interface moved here libmysqld/lib_sql.cc: all embedded 'virtual' functions moved here so they can be static libmysqld/libmysqld.c: embedded 'virtual' function was moved out of here sql-common/client.c: several changes with the declared goal sql/sql_class.h: place to store statement data added to THD sql/sql_prepare.cc: storing of prepare_statement result for embedded server added --- include/mysql.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'include/mysql.h') diff --git a/include/mysql.h b/include/mysql.h index 453325453af..c2f653e24d7 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -250,7 +250,6 @@ typedef struct st_mysql LIST *stmts; /* list of all statements */ const struct st_mysql_methods *methods; - struct st_mysql_res *result; void *thd; } MYSQL; @@ -359,6 +358,8 @@ int STDCALL mysql_send_query(MYSQL *mysql, const char *q, unsigned long length); int STDCALL mysql_real_query(MYSQL *mysql, const char *q, unsigned long length); +MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); + /* perform query on master */ my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q, unsigned long length); @@ -427,6 +428,8 @@ MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result, MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result); unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result); MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result); +MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, + const char *wild); unsigned long STDCALL mysql_escape_string(char *to,const char *from, unsigned long from_length); unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, @@ -538,9 +541,7 @@ typedef struct st_mysql_stmt #define mysql_read_query_result(mysql) (*(mysql)->methods->read_query_result)(mysql) -#define mysql_store_result(mysql) (*(mysql)->methods->store_result)(mysql) #define mysql_use_result(mysql) (*(mysql)->methods->use_result)(mysql) -#define mysql_list_fields(mysql, table, wild) (*(mysql)->methods->list_fields)(mysql, table, wild) typedef struct st_mysql_methods { @@ -552,12 +553,12 @@ typedef struct st_mysql_methods const char *arg, unsigned long arg_length, my_bool skip_check); - MYSQL_RES * (STDCALL *store_result)(MYSQL *mysql); + MYSQL_DATA *(STDCALL *read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields, + uint fields); MYSQL_RES * (STDCALL *use_result)(MYSQL *mysql); void (STDCALL *fetch_lengths)(unsigned long *to, MYSQL_ROW column, uint field_count); - MYSQL_RES * (STDCALL *list_fields)(MYSQL *mysql, const char *table, - const char *wild); + MYSQL_FIELD * (STDCALL *list_fields)(MYSQL *mysql); my_bool (STDCALL *read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt); } MYSQL_METHODS; -- cgit v1.2.1 From 6b05f916b8bd29af6205a946c4954bc3a2cb62df Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Sep 2003 15:18:18 +0500 Subject: SCRUM prepared statements in embedded library include/mysql.h: stmt_execute 'virtual' method added include/sql_common.h: two functions became global libmysql/client_settings.h: declaration for cli_stmt_execute libmysql/libmysql.c: some functions changed to be usable from embedded library libmysqld/lib_sql.cc: code for embedded stmt_execute added sql-common/client.c: cli_stmt_execute added to the methods table sql/client_settings.h: no need for prepared statements in miniclient --- include/mysql.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/mysql.h') diff --git a/include/mysql.h b/include/mysql.h index c2f653e24d7..6ec64220706 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -560,6 +560,7 @@ typedef struct st_mysql_methods MYSQL_ROW column, uint field_count); MYSQL_FIELD * (STDCALL *list_fields)(MYSQL *mysql); my_bool (STDCALL *read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt); + int (STDCALL *stmt_execute)(MYSQL_STMT *stmt); } MYSQL_METHODS; MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query, -- cgit v1.2.1 From 194f6725d42a111e31fbdff2707095abd7cd1b05 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Sep 2003 20:48:53 +0500 Subject: SCRUM: prepared statements in embedded library include/mysql.h: Another 'virtual' method libmysql/client_settings.h: client implementation declared libmysql/libmysql.c: mysql_execute edited to work with embedded implementation libmysqld/lib_sql.cc: one error fixed (we do need parameter's buffer in embedded library) embedded recordset transfer methods implementations added sql-common/client.c: method added to the table sql/client_settings.h: no prepared statements in mimiclient sql/mysql_priv.h: these functions became global sql/protocol.cc: the stub added sql/protocol.h: had to change Protocol's interface for embedded library sql/sql_class.h: i changed this only for embedded case, but i think it's better to do the same for remote server also sql/sql_prepare.cc: parts of code #ifndef-ed --- include/mysql.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/mysql.h') diff --git a/include/mysql.h b/include/mysql.h index 6ec64220706..a2da4f353f7 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -561,6 +561,8 @@ typedef struct st_mysql_methods MYSQL_FIELD * (STDCALL *list_fields)(MYSQL *mysql); my_bool (STDCALL *read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt); int (STDCALL *stmt_execute)(MYSQL_STMT *stmt); + MYSQL_DATA *(STDCALL *read_binary_rows)(MYSQL_STMT *stmt); + } MYSQL_METHODS; MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query, -- cgit v1.2.1 From 88fcf2a9433f60eddda31504ba14dfe87b375d2c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Sep 2003 18:28:42 +0500 Subject: SCRUM: embedded library I decided to get rid of #define mysql_some_function in mysql.h It puzzles users and makes problems with dynamic libraries Finally, there are only two functions left, that are covered with the #define-s and it won't hurt performance at all client/mysqltest.c: that'll be faster include/mysql.h: #defines changed to functions libmysql/libmysql.c: that'll be faster that calls of wrapper functions libmysqld/libmysqld.c: skip wrapper function sql-common/client.c: skip wrapper function --- include/mysql.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include/mysql.h') diff --git a/include/mysql.h b/include/mysql.h index a2da4f353f7..2feed6da1f9 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -359,6 +359,7 @@ int STDCALL mysql_send_query(MYSQL *mysql, const char *q, int STDCALL mysql_real_query(MYSQL *mysql, const char *q, unsigned long length); MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); +MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); /* perform query on master */ my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q, @@ -460,6 +461,7 @@ int STDCALL mysql_manager_command(MYSQL_MANAGER* con, int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con, char* res_buf, int res_buf_size); +my_bool STDCALL mysql_read_query_result(MYSQL *mysql); /* @@ -540,9 +542,6 @@ typedef struct st_mysql_stmt } MYSQL_STMT; -#define mysql_read_query_result(mysql) (*(mysql)->methods->read_query_result)(mysql) -#define mysql_use_result(mysql) (*(mysql)->methods->use_result)(mysql) - typedef struct st_mysql_methods { my_bool (STDCALL *read_query_result)(MYSQL *mysql); -- cgit v1.2.1 From 4c63804846d1530b602a74ff30ad26df7645a94b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Sep 2003 18:58:02 +0500 Subject: SCRUM embedded library some dirty places cleaned: uint removed from mysql.h as Miguel suggested empty_string renamed as my_empty_string to get rid of name's intersections using embedded library include/mysql.h: uint -> unsigned int include/mysql_com.h: this caused warnings when not in expression libmysqld/lib_sql.cc: uint -> unsigned int sql-common/client.c: uint -> unsigned int sql/item_strfunc.cc: empty_string -> my_empty_string sql/mysql_priv.h: empty_string -> my_empty_string sql/set_var.cc: empty_string -> my_empty_string sql/sql_class.cc: empty_string -> my_empty_string sql/sql_prepare.cc: net_flush ifdef-ed --- include/mysql.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/mysql.h') diff --git a/include/mysql.h b/include/mysql.h index 2feed6da1f9..f9f7342bc6d 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -553,10 +553,10 @@ typedef struct st_mysql_methods unsigned long arg_length, my_bool skip_check); MYSQL_DATA *(STDCALL *read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields, - uint fields); + unsigned int fields); MYSQL_RES * (STDCALL *use_result)(MYSQL *mysql); void (STDCALL *fetch_lengths)(unsigned long *to, - MYSQL_ROW column, uint field_count); + MYSQL_ROW column, unsigned int field_count); MYSQL_FIELD * (STDCALL *list_fields)(MYSQL *mysql); my_bool (STDCALL *read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt); int (STDCALL *stmt_execute)(MYSQL_STMT *stmt); -- cgit v1.2.1 From 83e8881a5ad2a0fdfcb1ad06adca3614b6c7e0e4 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 Sep 2003 14:05:28 +0500 Subject: SCRUM prepared statements in embedded library. some fixes after testing include/mysql.h: virtual method added libmysql/client_settings.h: declaration added libmysql/libmysql.c: implementation added mysql_fetch changed to work in both libraries libmysqld/lib_sql.cc: implementation added sql-common/client.c: added items in methods table sql/client_settings.h: decided to remove such defines - i placed single #ifdef in client.c --- include/mysql.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/mysql.h') diff --git a/include/mysql.h b/include/mysql.h index f9f7342bc6d..2e9147894ca 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -557,10 +557,13 @@ typedef struct st_mysql_methods MYSQL_RES * (STDCALL *use_result)(MYSQL *mysql); void (STDCALL *fetch_lengths)(unsigned long *to, MYSQL_ROW column, unsigned int field_count); +#if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY) MYSQL_FIELD * (STDCALL *list_fields)(MYSQL *mysql); my_bool (STDCALL *read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt); int (STDCALL *stmt_execute)(MYSQL_STMT *stmt); MYSQL_DATA *(STDCALL *read_binary_rows)(MYSQL_STMT *stmt); + int (STDCALL *unbuffered_fetch)(MYSQL *mysql, char **row); +#endif } MYSQL_METHODS; -- cgit v1.2.1