diff options
author | konstantin@mysql.com <> | 2005-06-17 23:26:25 +0400 |
---|---|---|
committer | konstantin@mysql.com <> | 2005-06-17 23:26:25 +0400 |
commit | b3d977df1071ab18440ae995bbcf974054abe209 (patch) | |
tree | c717e85867b447ea03e767d03e54e0085e7ecbee /sql | |
parent | c78b19768d9247ef5b1fd1cd3f15707a62df3a26 (diff) | |
download | mariadb-git-b3d977df1071ab18440ae995bbcf974054abe209.tar.gz |
Rename all prepared statements COM_ commands to prefix with COM_STMT_
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_cmpfunc.cc | 2 | ||||
-rw-r--r-- | sql/mysql_priv.h | 4 | ||||
-rw-r--r-- | sql/sql_class.h | 8 | ||||
-rw-r--r-- | sql/sql_lex.cc | 2 | ||||
-rw-r--r-- | sql/sql_parse.cc | 18 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 21 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 8 |
7 files changed, 29 insertions, 34 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index eabc89bc429..5a2e14eef2e 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -649,7 +649,7 @@ bool Item_in_optimizer::fix_left(THD *thd, If it is preparation PS only then we do not know values of parameters => cant't get there values and do not need that values. */ - if (!thd->only_prepare()) + if (!thd->current_arena->is_stmt_prepare()) cache->store(args[0]); if (cache->cols() == 1) { diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 336d493d669..5d40610a802 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -559,8 +559,6 @@ struct Query_cache_query_flags #define query_cache_invalidate_by_MyISAM_filename_ref NULL #endif /*HAVE_QUERY_CACHE*/ -#define prepare_execute(A) ((A)->command == COM_EXECUTE) - bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent); bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create); bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent); @@ -842,7 +840,7 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length, void mysql_stmt_execute(THD *thd, char *packet, uint packet_length); void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name); void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length); -void mysql_stmt_free(THD *thd, char *packet); +void mysql_stmt_close(THD *thd, char *packet); void mysql_stmt_reset(THD *thd, char *packet); void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length); void reinit_stmt_before_use(THD *thd, LEX *lex); diff --git a/sql/sql_class.h b/sql/sql_class.h index 6097fb1d4ed..84c8354dfab 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1046,7 +1046,7 @@ public: #endif struct st_my_thread_var *mysys_var; /* - Type of current query: COM_PREPARE, COM_QUERY, etc. Set from + Type of current query: COM_STMT_PREPARE, COM_QUERY, etc. Set from first byte of the packet in do_command() */ enum enum_server_command command; @@ -1338,13 +1338,9 @@ public: return 0; #endif } - inline bool only_prepare() - { - return command == COM_PREPARE; - } inline bool fill_derived_tables() { - return !only_prepare() && !lex->only_view_structure(); + return !current_arena->is_stmt_prepare() && !lex->only_view_structure(); } inline gptr trans_alloc(unsigned int size) { diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 1270aab18ae..d1adb66bd80 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -967,7 +967,7 @@ int yylex(void *arg, void *yythd) { THD* thd= (THD*)yythd; if ((thd->client_capabilities & CLIENT_MULTI_STATEMENTS) && - (thd->command != COM_PREPARE)) + (thd->command != COM_STMT_PREPARE)) { lex->safe_to_cache_query= 0; lex->found_semicolon=(char*) lex->ptr; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 91bccd4dd11..33339cf0882 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1634,32 +1634,32 @@ bool dispatch_command(enum enum_server_command command, THD *thd, } break; } - case COM_EXECUTE: + case COM_STMT_EXECUTE: { mysql_stmt_execute(thd, packet, packet_length); break; } - case COM_FETCH: + case COM_STMT_FETCH: { mysql_stmt_fetch(thd, packet, packet_length); break; } - case COM_LONG_DATA: + case COM_STMT_SEND_LONG_DATA: { mysql_stmt_get_longdata(thd, packet, packet_length); break; } - case COM_PREPARE: + case COM_STMT_PREPARE: { mysql_stmt_prepare(thd, packet, packet_length, 0); break; } - case COM_CLOSE_STMT: + case COM_STMT_CLOSE: { - mysql_stmt_free(thd, packet); + mysql_stmt_close(thd, packet); break; } - case COM_RESET_STMT: + case COM_STMT_RESET: { mysql_stmt_reset(thd, packet); break; @@ -2199,7 +2199,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, /* Read query from packet and store in thd->query - Used in COM_QUERY and COM_PREPARE + Used in COM_QUERY and COM_STMT_PREPARE DESCRIPTION Sets the following THD variables: @@ -2501,7 +2501,7 @@ mysql_execute_command(THD *thd) lex->prepared_stmt_name.str, query_len, query_str)); } - thd->command= COM_PREPARE; + thd->command= COM_STMT_PREPARE; if (!(res= mysql_stmt_prepare(thd, query_str, query_len + 1, &lex->prepared_stmt_name))) send_ok(thd, 0L, 0L, "Statement prepared"); diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 7af881790eb..80ebb09bac5 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -19,9 +19,9 @@ This file contains the implementation of prepare and executes. Prepare: - - Server gets the query from client with command 'COM_PREPARE'; + - Server gets the query from client with command 'COM_STMT_PREPARE'; in the following format: - [COM_PREPARE:1] [query] + [COM_STMT_PREPARE:1] [query] - Parse the query and recognize any parameter markers '?' and store its information list in lex->param_list - Allocate a new statement for this prepare; and keep this in @@ -37,10 +37,10 @@ Prepare: Prepare-execute: - - Server gets the command 'COM_EXECUTE' to execute the + - Server gets the command 'COM_STMT_EXECUTE' to execute the previously prepared query. If there is any param markers; then client will send the data in the following format: - [COM_EXECUTE:1] + [COM_STMT_EXECUTE:1] [STMT_ID:4] [NULL_BITS:(param_count+7)/8)] [TYPES_SUPPLIED_BY_CLIENT(0/1):1] @@ -55,9 +55,10 @@ Prepare-execute: Long data handling: - - Server gets the long data in pieces with command type 'COM_LONG_DATA'. + - Server gets the long data in pieces with command type + 'COM_STMT_SEND_LONG_DATA'. - The packet recieved will have the format as: - [COM_LONG_DATA:1][STMT_ID:4][parameter_number:2][data] + [COM_STMT_SEND_LONG_DATA:1][STMT_ID:4][parameter_number:2][data] - data from the packet is appended to long data value buffer for this placeholder. - It's up to the client to check for read data ended. The server doesn't @@ -2117,7 +2118,7 @@ void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name) { my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE"); } - thd->command= COM_EXECUTE; /* For nice messages in general log */ + thd->command= COM_STMT_EXECUTE; /* For nice messages in general log */ execute_stmt(thd, stmt, &expanded_query); DBUG_VOID_RETURN; } @@ -2185,7 +2186,7 @@ static void execute_stmt(THD *thd, Prepared_statement *stmt, /* - COM_FETCH handler: fetches requested amount of rows from cursor + COM_STMT_FETCH handler: fetches requested amount of rows from cursor SYNOPSIS mysql_stmt_fetch() @@ -2290,13 +2291,13 @@ void mysql_stmt_reset(THD *thd, char *packet) Note: we don't send any reply to that command. */ -void mysql_stmt_free(THD *thd, char *packet) +void mysql_stmt_close(THD *thd, char *packet) { /* There is always space for 4 bytes in packet buffer */ ulong stmt_id= uint4korr(packet); Prepared_statement *stmt; - DBUG_ENTER("mysql_stmt_free"); + DBUG_ENTER("mysql_stmt_close"); statistic_increment(thd->status_var.com_stmt_close, &LOCK_status); if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_close"))) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 892d2516808..508948bede1 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -914,7 +914,7 @@ deallocate: { THD *thd=YYTHD; LEX *lex= thd->lex; - if (thd->command == COM_PREPARE) + if (thd->command == COM_STMT_PREPARE) { yyerror(ER(ER_SYNTAX_ERROR)); YYABORT; @@ -939,7 +939,7 @@ prepare: { THD *thd=YYTHD; LEX *lex= thd->lex; - if (thd->command == COM_PREPARE) + if (thd->command == COM_STMT_PREPARE) { yyerror(ER(ER_SYNTAX_ERROR)); YYABORT; @@ -974,7 +974,7 @@ execute: { THD *thd=YYTHD; LEX *lex= thd->lex; - if (thd->command == COM_PREPARE) + if (thd->command == COM_STMT_PREPARE) { yyerror(ER(ER_SYNTAX_ERROR)); YYABORT; @@ -6902,7 +6902,7 @@ param_marker: { THD *thd=YYTHD; LEX *lex= thd->lex; - if (thd->command == COM_PREPARE) + if (thd->command == COM_STMT_PREPARE) { Item_param *item= new Item_param((uint) (lex->tok_start - (uchar *) thd->query)); |