diff options
author | Alexander Nozdrin <alik@sun.com> | 2010-02-24 16:52:27 +0300 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2010-02-24 16:52:27 +0300 |
commit | 04b8cb1882d895931380f2671fe942852e62bc24 (patch) | |
tree | 46d0af1ca06ba43198a4cde04fa6f0a3937b0118 /sql/sql_select.h | |
parent | bca31a686ded83db136be66efe36eab022ebf882 (diff) | |
parent | b416a553769cabf9b99232df39244c4f4a9f48c6 (diff) | |
download | mariadb-git-04b8cb1882d895931380f2671fe942852e62bc24.tar.gz |
Manual merge from mysql-trunk-merge.
Conflicts:
- client/mysql.cc
- client/mysqldump.c
- configure.in
- mysql-test/r/csv.result
- mysql-test/r/func_time.result
- mysql-test/r/show_check.result
- mysql-test/r/sp-error.result
- mysql-test/r/sp.result
- mysql-test/r/sp_trans.result
- mysql-test/r/type_blob.result
- mysql-test/r/type_timestamp.result
- mysql-test/r/warnings.result
- mysql-test/suite/rpl/r/rpl_sp.result
- sql/mysql_priv.h
- sql/mysqld.cc
- sql/sp.cc
- sql/sql_base.cc
- sql/sql_table.cc
- sql/sql_trigger.cc
- sql/sql_view.cc
- sql/table.h
- sql/share/errmsg.txt
- mysql-test/suite/sys_vars/r/log_bin_trust_routine_creators_basic.result
Diffstat (limited to 'sql/sql_select.h')
-rw-r--r-- | sql/sql_select.h | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h index c30aae4fbf9..3cec00a84c8 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -98,6 +98,10 @@ typedef struct st_table_ref } TABLE_REF; + +#define CACHE_BLOB 1 /* blob field */ +#define CACHE_STRIPPED 2 /* field stripped of trailing spaces */ + /** CACHE_FIELD and JOIN_CACHE is used on full join to cache records in outer table @@ -106,8 +110,8 @@ typedef struct st_table_ref typedef struct st_cache_field { uchar *str; uint length, blob_length; - Field_blob *blob_field; - bool strip; + Field *field; + uint type; /**< category of the of the copied field (CACHE_BLOB et al.) */ } CACHE_FIELD; @@ -361,7 +365,25 @@ public: */ bool no_const_tables; - JOIN *tmp_join; ///< copy of this JOIN to be used with temporary tables + /** + Copy of this JOIN to be used with temporary tables. + + tmp_join is used when the JOIN needs to be "reusable" (e.g. in a subquery + that gets re-executed several times) and we know will use temporary tables + for materialization. The materialization to a temporary table overwrites the + JOIN structure to point to the temporary table after the materialization is + done. This is where tmp_join is used : it's a copy of the JOIN before the + materialization and is used in restoring before re-execution by overwriting + the current JOIN structure with the saved copy. + Because of this we should pay extra care of not freeing up helper structures + that are referenced by the original contents of the JOIN. We can check for + this by making sure the "current" join is not the temporary copy, e.g. + !tmp_join || tmp_join != join + + We should free these sub-structures at JOIN::destroy() if the "current" join + has a copy is not that copy. + */ + JOIN *tmp_join; ROLLUP rollup; ///< Used with rollup bool select_distinct; ///< Set if SELECT DISTINCT @@ -724,10 +746,11 @@ public: we need to check for errors executing it and react accordingly */ if (!res && table->in_use->is_error()) - res= 2; + res= 1; /* STORE_KEY_FATAL */ dbug_tmp_restore_column_map(table->write_set, old_map); null_key= to_field->is_null() || item->null_value; - return (err != 0 || res > 2 ? STORE_KEY_FATAL : (store_key_result) res); + return ((err != 0 || res < 0 || res > 2) ? STORE_KEY_FATAL : + (store_key_result) res); } }; @@ -756,17 +779,17 @@ protected: if ((res= item->save_in_field(to_field, 1))) { if (!err) - err= res; + err= res < 0 ? 1 : res; /* 1=STORE_KEY_FATAL */ } /* Item::save_in_field() may call Item::val_xxx(). And if this is a subquery we need to check for errors executing it and react accordingly */ if (!err && to_field->table->in_use->is_error()) - err= 2; + err= 1; /* STORE_KEY_FATAL */ } null_key= to_field->is_null() || item->null_value; - return (err > 2 ? STORE_KEY_FATAL : (store_key_result) err); + return (err > 2 ? STORE_KEY_FATAL : (store_key_result) err); } }; |