Commit c5233703 authored by Olivier Bertrand's avatar Olivier Bertrand

Fix bug on readonly table option not recognized

in TABDEF::Define line 104

Modified:
reldef.cpp

Add a warning on alter in check_if_incompatible_data.

Modified:
ha_connect.cc
parent 5fc2a7da
...@@ -1241,6 +1241,17 @@ bool ha_connect::OpenTable(PGLOBAL g, bool del) ...@@ -1241,6 +1241,17 @@ bool ha_connect::OpenTable(PGLOBAL g, bool del)
if (!(tdbp= GetTDB(g))) if (!(tdbp= GetTDB(g)))
return true; return true;
else if (tdbp->IsReadOnly())
switch (xmod) {
case MODE_WRITE:
case MODE_INSERT:
case MODE_UPDATE:
case MODE_DELETE:
strcpy(g->Message, MSG(READ_ONLY));
return true;
default:
break;
} // endswitch xmode
// Get the list of used fields (columns) // Get the list of used fields (columns)
char *p; char *p;
...@@ -3527,10 +3538,10 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info) ...@@ -3527,10 +3538,10 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
Called from handle.cc by ha_create_table(). Called from handle.cc by ha_create_table().
@note @note
Currently we do nothing here because we suppose that the PlugDB matching Currently we do some checking on the create definitions and stop
table already exists. At least we should check that the table definition creating if an error is found. We wish we could change the table
for MariaDB exactly match the PlugDB one. Later we should make possible definition such as providing a default table type. However, as said
to entirely create a table from MariaDB. above, there are no method to do so.
@see @see
ha_create_table() in handle.cc ha_create_table() in handle.cc
...@@ -3711,6 +3722,9 @@ bool ha_connect::check_if_incompatible_data(HA_CREATE_INFO *info, ...@@ -3711,6 +3722,9 @@ bool ha_connect::check_if_incompatible_data(HA_CREATE_INFO *info,
//ha_table_option_struct *param_old, *param_new; //ha_table_option_struct *param_old, *param_new;
DBUG_ENTER("ha_connect::check_if_incompatible_data"); DBUG_ENTER("ha_connect::check_if_incompatible_data");
// TO DO: implement it. // TO DO: implement it.
if (table)
push_warning(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"No check done for compatible changes, you are on your own!");
DBUG_RETURN(COMPATIBLE_DATA_YES); DBUG_RETURN(COMPATIBLE_DATA_YES);
} }
......
...@@ -101,8 +101,7 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am) ...@@ -101,8 +101,7 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am)
Elemt = cat->GetIntCatInfo(name, "Elements", 0); Elemt = cat->GetIntCatInfo(name, "Elements", 0);
Multiple = cat->GetIntCatInfo(name, "Multiple", 0); Multiple = cat->GetIntCatInfo(name, "Multiple", 0);
Degree = cat->GetIntCatInfo(name, "Degree", 0); Degree = cat->GetIntCatInfo(name, "Degree", 0);
cat->GetCharCatInfo(name, "ReadOnly", "No", buf, sizeof(buf)); Read_Only = cat->GetBoolCatInfo(name, "ReadOnly", false);
Read_Only = (toupper(*buf) == 'Y');
// Get The column definitions // Get The column definitions
if ((poff = cat->GetColCatInfo(g, this)) < 0) if ((poff = cat->GetColCatInfo(g, this)) < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment