diff options
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 505f64dff43..b4d370491bb 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -34,6 +34,8 @@ #endif #ifdef HAVE_INNOBASE_DB #include "ha_innodb.h" +#else +#define innobase_query_caching_of_table_permitted(X,Y,Z) 1 #endif #include <myisampack.h> #include <errno.h> @@ -86,7 +88,12 @@ enum db_type ha_checktype(enum db_type database_type) #endif #ifdef HAVE_ISAM case DB_TYPE_ISAM: + return (isam_skip ? DB_TYPE_MYISAM : database_type); case DB_TYPE_MRG_ISAM: + return (isam_skip ? DB_TYPE_MRG_MYISAM : database_type); +#else + case DB_TYPE_MRG_ISAM: + return (DB_TYPE_MRG_MYISAM); #endif case DB_TYPE_HEAP: case DB_TYPE_MYISAM: @@ -110,6 +117,9 @@ handler *get_new_handler(TABLE *table, enum db_type db_type) return new ha_isammrg(table); case DB_TYPE_ISAM: return new ha_isam(table); +#else + case DB_TYPE_MRG_ISAM: + return new ha_myisammrg(table); #endif #ifdef HAVE_BERKELEY_DB case DB_TYPE_BERKELEY_DB: @@ -673,6 +683,11 @@ int handler::analyze(THD* thd, HA_CHECK_OPT* check_opt) return HA_ADMIN_NOT_IMPLEMENTED; } +int handler::preload_keys(THD* thd, HA_CHECK_OPT* check_opt) +{ + return HA_ADMIN_NOT_IMPLEMENTED; +} + /* Read first row (only) from a table This is never called for InnoDB or BDB tables, as these table types @@ -745,18 +760,24 @@ void handler::update_auto_increment() longlong nr; THD *thd; DBUG_ENTER("update_auto_increment"); - if (table->next_number_field->val_int() != 0) + if (table->next_number_field->val_int() != 0 || + table->auto_increment_field_not_null && + current_thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO) { + table->auto_increment_field_not_null= false; auto_increment_column_changed=0; DBUG_VOID_RETURN; } + table->auto_increment_field_not_null= false; thd=current_thd; if ((nr=thd->next_insert_id)) thd->next_insert_id=0; // Clear after use else nr=get_auto_increment(); - thd->insert_id((ulonglong) nr); - table->next_number_field->store(nr); + if (!table->next_number_field->store(nr)) + thd->insert_id((ulonglong) nr); + else + thd->insert_id(table->next_number_field->val_int()); auto_increment_column_changed=1; DBUG_VOID_RETURN; } @@ -825,7 +846,7 @@ void handler::print_error(int error, myf errflag) { /* Write the dupplicated key in the error message */ char key[MAX_KEY_LENGTH]; - String str(key,sizeof(key)); + String str(key,sizeof(key),system_charset_info); key_unpack(&str,table,(uint) key_nr); uint max_length=MYSQL_ERRMSG_SIZE-(uint) strlen(ER(ER_DUP_ENTRY)); if (str.length() >= max_length) @@ -978,6 +999,16 @@ int handler::delete_all_rows() return (my_errno=HA_ERR_WRONG_COMMAND); } +bool handler::caching_allowed(THD* thd, char* table_key, + uint key_length, uint8 cache_type) +{ + if (cache_type == HA_CACHE_TBL_ASKTRANSACT) + return innobase_query_caching_of_table_permitted(thd, table_key, + key_length); + else + return 1; +} + /**************************************************************************** ** Some general functions that isn't in the handler class ****************************************************************************/ |