diff options
Diffstat (limited to 'storage/connect/ha_connect.cc')
-rw-r--r-- | storage/connect/ha_connect.cc | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index e79682d331b..d07b657389d 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -170,9 +170,9 @@ #define JSONMAX 10 // JSON Default max grp size extern "C" { - char version[]= "Version 1.06.0008 October 06, 2018"; + char version[]= "Version 1.06.0009 January 27, 2019"; #if defined(__WIN__) - char compver[]= "Version 1.06.0008 " __DATE__ " " __TIME__; + char compver[]= "Version 1.06.0009 " __DATE__ " " __TIME__; char slash= '\\'; #else // !__WIN__ char slash= '/'; @@ -204,6 +204,26 @@ pthread_mutex_t parmut; pthread_mutex_t usrmut; pthread_mutex_t tblmut; +#if defined(DEVELOPMENT) +char *GetUserVariable(PGLOBAL g, const uchar *varname); + +char *GetUserVariable(PGLOBAL g, const uchar *varname) +{ + char buf[1024]; + bool b; + THD *thd = current_thd; + CHARSET_INFO *cs = system_charset_info; + String *str = NULL, tmp(buf, sizeof(buf), cs); + HASH uvars = thd->user_vars; + user_var_entry *uvar = (user_var_entry*)my_hash_search(&uvars, varname, 0); + + if (uvar) + str = uvar->val_str(&b, &tmp, NOT_FIXED_DEC); + + return str ? PlugDup(g, str->ptr()) : NULL; +}; // end of GetUserVariable +#endif // DEVELOPMENT + /***********************************************************************/ /* Utility functions. */ /***********************************************************************/ @@ -1793,7 +1813,9 @@ PCSZ ha_connect::GetDBName(PCSZ name) const char *ha_connect::GetTableName(void) { - return tshp ? tshp->table_name.str : table_share->table_name.str; + const char *path= tshp ? tshp->path.str : table_share->path.str; + const char *name= strrchr(path, '/'); + return name ? name+1 : path; } // end of GetTableName char *ha_connect::GetPartName(void) @@ -1912,9 +1934,11 @@ int ha_connect::OpenTable(PGLOBAL g, bool del) break; } // endswitch xmode - if (xmod != MODE_INSERT || tdbp->GetAmType() == TYPE_AM_MYSQL - || tdbp->GetAmType() == TYPE_AM_ODBC - || tdbp->GetAmType() == TYPE_AM_JDBC) { + // g->More is 1 when executing commands from triggers + if (!g->More && (xmod != MODE_INSERT + || tdbp->GetAmType() == TYPE_AM_MYSQL + || tdbp->GetAmType() == TYPE_AM_ODBC + || tdbp->GetAmType() == TYPE_AM_JDBC)) { // Get the list of used fields (columns) char *p; unsigned int k1, k2, n1, n2; @@ -4629,7 +4653,9 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd, break; case SQLCOM_CREATE_VIEW: case SQLCOM_DROP_VIEW: - newmode= MODE_ANY; + case SQLCOM_CREATE_TRIGGER: + case SQLCOM_DROP_TRIGGER: + newmode= MODE_ANY; break; case SQLCOM_ALTER_TABLE: *chk= true; @@ -4672,6 +4698,9 @@ int ha_connect::start_stmt(THD *thd, thr_lock_type lock_type) PGLOBAL g= GetPlug(thd, xp); DBUG_ENTER("ha_connect::start_stmt"); + if (table->triggers) + g->More= 1; // We don't know which columns are used by the trigger + if (check_privileges(thd, GetTableOptionStruct(), table->s->db.str, true)) DBUG_RETURN(HA_ERR_INTERNAL_ERROR); @@ -7310,7 +7339,7 @@ maria_declare_plugin(connect) 0x0106, /* version number (1.06) */ NULL, /* status variables */ connect_system_variables, /* system variables */ - "1.06.0008", /* string version */ + "1.06.0009", /* string version */ MariaDB_PLUGIN_MATURITY_STABLE /* maturity */ } maria_declare_plugin_end; |