mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fix failing test mysql_client_test
Backported patch from 10.3 that allows one to remove short .frm files
This commit is contained in:
@@ -72,33 +72,36 @@ Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name,
|
||||
if ((file= mysql_file_open(key_file_frm, path, O_RDONLY | O_SHARE, MYF(0)))
|
||||
< 0)
|
||||
DBUG_RETURN(TABLE_TYPE_UNKNOWN);
|
||||
error= mysql_file_read(file, (uchar*) header, sizeof(header), MYF(MY_NABP));
|
||||
|
||||
if (error)
|
||||
/*
|
||||
We return TABLE_TYPE_NORMAL if we can open the .frm file. This allows us
|
||||
to drop a bad .frm file with DROP TABLE
|
||||
*/
|
||||
type= TABLE_TYPE_NORMAL;
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
if (engine_name)
|
||||
{
|
||||
engine_name->length= 0;
|
||||
((char*) (engine_name->str))[0]= 0;
|
||||
}
|
||||
|
||||
if ((error= mysql_file_read(file, (uchar*) header, sizeof(header), MYF(MY_NABP))))
|
||||
goto err;
|
||||
|
||||
if (!strncmp((char*) header, "TYPE=VIEW\n", 10))
|
||||
{
|
||||
type= TABLE_TYPE_VIEW;
|
||||
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;
|
||||
|
||||
/* 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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user