summaryrefslogtreecommitdiff
path: root/sql/datadict.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-11-07 23:02:39 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-11-07 23:02:39 +0200
commit843e4508c0aa9fe50f750523b64ff04f517a2dea (patch)
tree06fa2a83f3e65f28832c46285236d3a5b8b568a1 /sql/datadict.cc
parenta4feb04ace2e7759aee4dd74b71cbb1151b1886f (diff)
parent5691109689bc40fa303c1b7ddc84b9209ec5f869 (diff)
downloadmariadb-git-843e4508c0aa9fe50f750523b64ff04f517a2dea.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'sql/datadict.cc')
-rw-r--r--sql/datadict.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/datadict.cc b/sql/datadict.cc
index 103a33214ae..ec3d65f0113 100644
--- a/sql/datadict.cc
+++ b/sql/datadict.cc
@@ -45,6 +45,8 @@ static int read_string(File file, uchar**to, size_t length)
engine_name is a LEX_STRING, 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
@retval FRMTYPE_ERROR error
@retval FRMTYPE_TABLE table
@@ -72,12 +74,23 @@ frm_type_enum dd_frm_type(THD *thd, char *path, LEX_STRING *engine_name)
goto err;
}
+ /*
+ We return FRMTYPE_TABLE if we can read the .frm file. This allows us
+ to drop a bad .frm file with DROP TABLE
+ */
type= FRMTYPE_TABLE;
- 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 */
engine_name->length= 0;
+ engine_name->str[0]= 0;
+
+ if (!is_binary_frm_header(header))
+ goto err;
+
dbt= header[3];
/* cannot use ha_resolve_by_legacy_type without a THD */