mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
This commit is contained in:
@@ -434,15 +434,6 @@ public:
|
||||
*/
|
||||
ulong id;
|
||||
|
||||
/*
|
||||
Id of current query. Statement can be reused to execute several queries
|
||||
query_id is global in context of the whole MySQL server.
|
||||
ID is automatically generated from mutex-protected counter.
|
||||
It's used in handler code for various purposes: to check which columns
|
||||
from table are necessary for this select, to check if it's necessary to
|
||||
update auto-updatable fields (like auto_increment and timestamp).
|
||||
*/
|
||||
ulong query_id;
|
||||
/*
|
||||
- if set_query_id=1, we set field->query_id for all fields. In that case
|
||||
field list can not contain duplicates.
|
||||
@@ -461,11 +452,6 @@ public:
|
||||
See item_sum.cc for details.
|
||||
*/
|
||||
bool allow_sum_func;
|
||||
/*
|
||||
Type of current query: COM_PREPARE, COM_QUERY, etc. Set from
|
||||
first byte of the packet in do_command()
|
||||
*/
|
||||
enum enum_server_command command;
|
||||
|
||||
LEX *lex; // parse tree descriptor
|
||||
/*
|
||||
@@ -676,6 +662,11 @@ public:
|
||||
uint dbug_sentry; // watch out for memory corruption
|
||||
#endif
|
||||
struct st_my_thread_var *mysys_var;
|
||||
/*
|
||||
Type of current query: COM_PREPARE, COM_QUERY, etc. Set from
|
||||
first byte of the packet in do_command()
|
||||
*/
|
||||
enum enum_server_command command;
|
||||
uint32 server_id;
|
||||
uint32 file_id; // for LOAD DATA INFILE
|
||||
/*
|
||||
@@ -751,6 +742,15 @@ public:
|
||||
List <MYSQL_ERROR> warn_list;
|
||||
uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
|
||||
uint total_warn_count;
|
||||
/*
|
||||
Id of current query. Statement can be reused to execute several queries
|
||||
query_id is global in context of the whole MySQL server.
|
||||
ID is automatically generated from mutex-protected counter.
|
||||
It's used in handler code for various purposes: to check which columns
|
||||
from table are necessary for this select, to check if it's necessary to
|
||||
update auto-updatable fields (like auto_increment and timestamp).
|
||||
*/
|
||||
ulong query_id;
|
||||
ulong warn_id, version, options, thread_id, col_access;
|
||||
|
||||
/* Statement id is thread-wide. This counter is used to generate ids */
|
||||
|
||||
Reference in New Issue
Block a user