diff options
author | Monty <monty@mariadb.org> | 2017-11-09 23:21:41 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-11-09 23:21:41 +0200 |
commit | 0bb0d52221af99c46d17486382806caa6dd7338e (patch) | |
tree | 92b2ddfceaf8df5be6d47774b25fd3006ac5bb35 /sql/datadict.cc | |
parent | 7dbff2c513aeec3b3f3d0fa4952ae97deba22282 (diff) | |
parent | d40c23570ff1a9ba5aa317b85a32a4b27780b8ab (diff) | |
download | mariadb-git-0bb0d52221af99c46d17486382806caa6dd7338e.tar.gz |
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Conflicts:
mysql-test/r/cte_recursive.result
mysql-test/r/derived_cond_pushdown.result
mysql-test/t/cte_recursive.test
mysql-test/t/derived_cond_pushdown.test
sql/datadict.cc
sql/handler.cc
Diffstat (limited to 'sql/datadict.cc')
-rw-r--r-- | sql/datadict.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sql/datadict.cc b/sql/datadict.cc index edc9fe5681b..5b70639174c 100644 --- a/sql/datadict.cc +++ b/sql/datadict.cc @@ -46,11 +46,13 @@ static int read_string(File file, uchar**to, size_t length) engine_name is a LEX_CSTRING, where engine_name->str must point to a buffer of at least NAME_CHAR_LEN+1 bytes. + If engine_name is 0, then the function will only test if the file is a + view or not @param[out] is_sequence 1 if table is a SEQUENCE, 0 otherwise @retval TABLE_TYPE_UNKNOWN error - @retval TABLE_TYPE_TABLE table + @retval TABLE_TYPE_NORMAL table @retval TABLE_TYPE_SEQUENCE sequence table @retval TABLE_TYPE_VIEW view */ @@ -80,12 +82,26 @@ Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name, goto err; } + /* + We return TABLE_TYPE_NORMAL if we can read the .frm file. This allows us + to drop a bad .frm file with DROP TABLE + */ type= TABLE_TYPE_NORMAL; - if (!is_binary_frm_header(header) || !engine_name) + /* engine_name is 0 if we only want to know if table is view or not */ + if (!engine_name) goto err; + /* + Initialize engine name in case we are not able to find it out + The cast is safe, as engine_name->str points to a usable buffer. + */ engine_name->length= 0; + ((char*) (engine_name->str))[0]= 0; + + if (!is_binary_frm_header(header)) + goto err; + dbt= header[3]; if (((header[39] >> 4) & 3) == HA_CHOICE_YES) |