Commit 2ad6e653 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix bug to allow creating views.

modified:
  storage/connect/ha_connect.cc
parent 70622eaa
...@@ -2897,6 +2897,7 @@ bool ha_connect::check_privileges(THD *thd, PTOS options) ...@@ -2897,6 +2897,7 @@ bool ha_connect::check_privileges(THD *thd, PTOS options)
case TAB_JCT: case TAB_JCT:
case TAB_DMY: case TAB_DMY:
case TAB_NIY: case TAB_NIY:
case TAB_PIVOT:
goto err; goto err;
case TAB_DOS: case TAB_DOS:
...@@ -2920,7 +2921,6 @@ bool ha_connect::check_privileges(THD *thd, PTOS options) ...@@ -2920,7 +2921,6 @@ bool ha_connect::check_privileges(THD *thd, PTOS options)
return check_access(thd, FILE_ACL, NULL, NULL, NULL, 0, 0); return check_access(thd, FILE_ACL, NULL, NULL, NULL, 0, 0);
case TAB_TBL: case TAB_TBL:
case TAB_PIVOT:
return false; return false;
} }
...@@ -2957,6 +2957,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) ...@@ -2957,6 +2957,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
int rc= 0; int rc= 0;
bool del= false; bool del= false;
MODE newmode; MODE newmode;
PTOS options= GetTableOptionStruct(table);
PGLOBAL g= GetPlug(thd); PGLOBAL g= GetPlug(thd);
DBUG_ENTER("ha_connect::external_lock"); DBUG_ENTER("ha_connect::external_lock");
...@@ -2966,9 +2967,11 @@ int ha_connect::external_lock(THD *thd, int lock_type) ...@@ -2966,9 +2967,11 @@ int ha_connect::external_lock(THD *thd, int lock_type)
if (!g) if (!g)
DBUG_RETURN(HA_ERR_INTERNAL_ERROR); DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
PTOS options= GetTableOptionStruct(table); if (lock_type != F_UNLCK && check_privileges(thd, options)) {
if (lock_type != F_UNLCK && check_privileges(thd, options)) strcpy(g->Message, "This operation requires the FILE privilege");
printf("%s\n", g->Message);
DBUG_RETURN(HA_ERR_INTERNAL_ERROR); DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
} // endif check_privileges
// Action will depend on lock_type // Action will depend on lock_type
switch (lock_type) { switch (lock_type) {
...@@ -3081,6 +3084,10 @@ int ha_connect::external_lock(THD *thd, int lock_type) ...@@ -3081,6 +3084,10 @@ int ha_connect::external_lock(THD *thd, int lock_type)
newmode= MODE_ANY; newmode= MODE_ANY;
// stop= true; // stop= true;
break; break;
case SQLCOM_CREATE_VIEW:
case SQLCOM_DROP_VIEW:
newmode= MODE_ANY;
break;
default: default:
printf("Unsupported sql_command=%d", thd->lex->sql_command); printf("Unsupported sql_command=%d", thd->lex->sql_command);
sprintf(g->Message, "Unsupported sql_command=%d", thd->lex->sql_command); sprintf(g->Message, "Unsupported sql_command=%d", thd->lex->sql_command);
...@@ -3111,6 +3118,10 @@ int ha_connect::external_lock(THD *thd, int lock_type) ...@@ -3111,6 +3118,10 @@ int ha_connect::external_lock(THD *thd, int lock_type)
case SQLCOM_ALTER_TABLE: case SQLCOM_ALTER_TABLE:
newmode= MODE_ANY; newmode= MODE_ANY;
break; break;
case SQLCOM_CREATE_VIEW:
case SQLCOM_DROP_VIEW:
newmode= MODE_ANY;
break;
default: default:
printf("Unsupported sql_command=%d", thd->lex->sql_command); printf("Unsupported sql_command=%d", thd->lex->sql_command);
sprintf(g->Message, "Unsupported sql_command=%d", thd->lex->sql_command); sprintf(g->Message, "Unsupported sql_command=%d", thd->lex->sql_command);
......
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