summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorunknown <konstantin@oak.local>2004-03-02 22:39:50 +0300
committerunknown <konstantin@oak.local>2004-03-02 22:39:50 +0300
commit7b68eaafda1c553bc519e797d6c4dbf5847d3bbe (patch)
treed108cc6395d7ecb8169af4abe81b03df2d2fbea9 /sql/sql_class.cc
parent8286684e26d1639b56c942e0cce6c238a11f2a92 (diff)
downloadmariadb-git-7b68eaafda1c553bc519e797d6c4dbf5847d3bbe.tar.gz
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
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc13
1 files changed, 2 insertions, 11 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 6fe0521b07a..95374b691c8 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -145,8 +145,7 @@ THD::THD():user_time(0), current_statement(0), is_fatal_error(0),
init();
/* Initialize sub structures */
- bzero((char*) &transaction.mem_root,sizeof(transaction.mem_root));
- bzero((char*) &warn_root,sizeof(warn_root));
+ clear_alloc_root(&transaction.mem_root);
init_alloc_root(&warn_root, WARN_ALLOC_BLOCK_SIZE, WARN_ALLOC_PREALLOC_SIZE);
user_connect=(USER_CONN *)0;
hash_init(&user_vars, &my_charset_bin, USER_VARS_HASH_SIZE, 0, 0,
@@ -331,7 +330,7 @@ THD::~THD()
dbug_sentry = THD_SENTRY_GONE;
#endif
/* Reset stmt_backup.mem_root to not double-free memory from thd.mem_root */
- init_alloc_root(&stmt_backup.mem_root, 0, 0);
+ clear_alloc_root(&stmt_backup.mem_root);
DBUG_VOID_RETURN;
}
@@ -1185,10 +1184,8 @@ int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
Statement::Statement(THD *thd)
:id(++thd->statement_id_counter),
- query_id(thd->query_id),
set_query_id(1),
allow_sum_func(0),
- command(thd->command),
lex(&main_lex),
query(0),
query_length(0),
@@ -1207,10 +1204,8 @@ Statement::Statement(THD *thd)
Statement::Statement()
:id(0),
- query_id(0), /* initialized later */
set_query_id(1),
allow_sum_func(0), /* initialized later */
- command(COM_SLEEP), /* initialized later */
lex(&main_lex),
query(0), /* these two are set */
query_length(0), /* in alloc_query() */
@@ -1229,15 +1224,11 @@ Statement::Type Statement::type() const
void Statement::set_statement(Statement *stmt)
{
id= stmt->id;
- query_id= stmt->query_id;
set_query_id= stmt->set_query_id;
allow_sum_func= stmt->allow_sum_func;
- command= stmt->command;
lex= stmt->lex;
query= stmt->query;
query_length= stmt->query_length;
- free_list= stmt->free_list;
- mem_root= stmt->mem_root;
}