summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <venu@myvenu.com>2003-01-11 00:36:13 -0800
committerunknown <venu@myvenu.com>2003-01-11 00:36:13 -0800
commit667a81eb27b2f8115576991d96689f73bbfdf46f (patch)
tree77b361c7ced62d24e50d0061b3eac8e788d6ef7f
parenta3ffb06a8c6e76dc1fc3d88493a6e6c98af14e92 (diff)
downloadmariadb-git-667a81eb27b2f8115576991d96689f73bbfdf46f.tar.gz
Fix to make the tables re-inited for every execute call
-rw-r--r--sql/sql_prepare.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 092f7c7a497..3907995676f 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -628,7 +628,7 @@ static bool parse_prepare_query(PREP_STMT *stmt,
Initialize parameter items in statement
*/
-static bool init_param_items( PREP_STMT *stmt)
+static bool init_param_items(PREP_STMT *stmt)
{
List<Item> &params= stmt->thd->lex.param_list;
Item_param **to;
@@ -643,6 +643,24 @@ static bool init_param_items( PREP_STMT *stmt)
}
/*
+ Initialize stmt execution
+*/
+
+static void init_stmt_execute(PREP_STMT *stmt)
+{
+ THD *thd= stmt->thd;
+ TABLE_LIST *tables=(TABLE_LIST*) thd->lex.select_lex.table_list.first;
+
+ /*
+ TODO: When the new table structure is ready, then have a status bit
+ to indicate the table is altered, and re-do the setup_*
+ and open the tables back.
+ */
+ if (tables)
+ tables->table=0; //safety - nasty init
+}
+
+/*
Parse the query and send the total number of parameters
and resultset metadata information back to client (if any),
without executing the query i.e. with out any log/disk
@@ -722,6 +740,8 @@ void mysql_stmt_execute(THD *thd, char *packet)
DBUG_VOID_RETURN;
}
+ init_stmt_execute(stmt);
+
if (stmt->param_count && setup_params_data(stmt))
DBUG_VOID_RETURN;