diff options
author | unknown <anozdrin@mysql.com> | 2005-10-25 13:02:48 +0400 |
---|---|---|
committer | unknown <anozdrin@mysql.com> | 2005-10-25 13:02:48 +0400 |
commit | 5ed3b0b3d7d3474823b9d07844b74620d6b6b065 (patch) | |
tree | c016532cef6719e53b426f6b3d9f5a4ebcd8c0ba /sql | |
parent | 215602cbe39243e9b6421894e11aa52ef576da81 (diff) | |
download | mariadb-git-5ed3b0b3d7d3474823b9d07844b74620d6b6b065.tar.gz |
Fix for BUG#13037: undefined variable in IF cause erroneous error-message.
mysql-test/r/sp-error.result:
Results for the test case for BUG#13037.
mysql-test/t/sp-error.test:
Test case for BUG#13037.
sql/sql_base.cc:
Polishing: use constant.
sql/sql_class.cc:
Reset THD::where in THD::cleanup_after_query();
Polishing: use the constant (THD::DEFAULT_WHERE).
sql/sql_class.h:
Introduce a constant for the default value of THD::where.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_base.cc | 2 | ||||
-rw-r--r-- | sql/sql_class.cc | 6 | ||||
-rw-r--r-- | sql/sql_class.h | 8 |
3 files changed, 14 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index d4376a65594..973fbca12f5 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4272,7 +4272,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array, thd->set_query_id=set_query_id; thd->allow_sum_func= allow_sum_func; - thd->where="field list"; + thd->where= THD::DEFAULT_WHERE; /* To prevent fail on forward lookup we fill it with zerows, diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 609156ef5a8..fc9df020b6c 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -44,6 +44,8 @@ */ char internal_table_name[2]= "*"; +const char * const THD::DEFAULT_WHERE= "field list"; + /***************************************************************************** ** Instansiate templates @@ -234,7 +236,7 @@ THD::THD() /* Variables with default values */ proc_info="login"; - where="field list"; + where= THD::DEFAULT_WHERE; server_id = ::server_id; slave_net = 0; command=COM_CONNECT; @@ -545,6 +547,8 @@ void THD::cleanup_after_query() } /* Free Items that were created during this execution */ free_items(); + /* Reset where. */ + where= THD::DEFAULT_WHERE; } /* diff --git a/sql/sql_class.h b/sql/sql_class.h index 2679143e9a5..7ca168ec518 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1109,6 +1109,14 @@ class THD :public Statement, public Open_tables_state { public: + /* + Constant for THD::where initialization in the beginning of every query. + + It's needed because we do not save/restore THD::where normally during + primary (non subselect) query execution. + */ + static const char * const DEFAULT_WHERE; + #ifdef EMBEDDED_LIBRARY struct st_mysql *mysql; struct st_mysql_data *data; |