Loading mysql-test/r/sql_mode.result +18 −0 Original line number Diff line number Diff line Loading @@ -402,4 +402,22 @@ a\b a\"b a'\b a'\"b SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b"; a\b a\'b a"\b a"\'b a\b a\'b a"\b a"\'b set session sql_mode = 'NO_ENGINE_SUBSTITUTION'; create table t1 (a int) engine=isam; ERROR HY000: The 'ISAM' feature is disabled; you need MySQL built with 'ISAM' to have it working show create table t1; ERROR 42S02: Table 'test.t1' doesn't exist drop table if exists t1; Warnings: Note 1051 Unknown table 't1' set session sql_mode = ''; create table t1 (a int) engine=isam; Warnings: Warning 1266 Using storage engine MyISAM for table 't1' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; SET @@SQL_MODE=@OLD_SQL_MODE; mysql-test/t/sql_mode.test +20 −0 Original line number Diff line number Diff line Loading @@ -189,4 +189,24 @@ SET @@SQL_MODE=''; SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b'; SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b"; # # Bug#6877: MySQL should give an error if the requested table type # is not available # set session sql_mode = 'NO_ENGINE_SUBSTITUTION'; --error 1289 create table t1 (a int) engine=isam; --error 1146 show create table t1; drop table if exists t1; # for comparison, lets see the warnings... set session sql_mode = ''; create table t1 (a int) engine=isam; show create table t1; drop table t1; SET @@SQL_MODE=@OLD_SQL_MODE; sql/handler.cc +12 −3 Original line number Diff line number Diff line Loading @@ -165,12 +165,22 @@ my_bool ha_storage_engine_is_enabled(enum db_type database_type) /* Use other database handler if databasehandler is not incompiled */ enum db_type ha_checktype(enum db_type database_type) enum db_type ha_checktype(THD *thd, enum db_type database_type, bool no_substitute, bool report_error) { THD *thd; if (ha_storage_engine_is_enabled(database_type)) return database_type; if (no_substitute) { if (report_error) { const char *engine_name= ha_get_storage_engine(database_type); my_error(ER_FEATURE_DISABLED,MYF(0),engine_name,engine_name); } return DB_TYPE_UNKNOWN; } switch (database_type) { #ifndef NO_HASH case DB_TYPE_HASH: Loading @@ -182,7 +192,6 @@ enum db_type ha_checktype(enum db_type database_type) break; } thd= current_thd; return ((enum db_type) thd->variables.table_type != DB_TYPE_UNKNOWN ? (enum db_type) thd->variables.table_type : ((enum db_type) global_system_variables.table_type != Loading sql/handler.h +2 −1 Original line number Diff line number Diff line Loading @@ -813,7 +813,8 @@ extern ulong total_ha, total_ha_2pc; enum db_type ha_resolve_by_name(const char *name, uint namelen); const char *ha_get_storage_engine(enum db_type db_type); handler *get_new_handler(TABLE *table, enum db_type db_type); enum db_type ha_checktype(enum db_type database_type); enum db_type ha_checktype(THD *thd, enum db_type database_type, bool no_substitute, bool report_error); /* basic stuff */ int ha_init(void); Loading sql/mysql_priv.h +3 −2 Original line number Diff line number Diff line Loading @@ -325,6 +325,7 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset; #define MODE_TRADITIONAL (MODE_ERROR_FOR_DIVISION_BY_ZERO*2) #define MODE_NO_AUTO_CREATE_USER (MODE_TRADITIONAL*2) #define MODE_HIGH_NOT_PRECEDENCE (MODE_NO_AUTO_CREATE_USER*2) #define MODE_NO_ENGINE_SUBSTITUTION (MODE_HIGH_NOT_PRECEDENCE*2) /* Replication uses 8 bytes to store SQL_MODE in the binary log. The day you use strictly more than 64 bits by adding one more define above, you should Loading Loading @@ -1230,7 +1231,7 @@ int openfrm(THD *thd, const char *name,const char *alias,uint filestat, int readfrm(const char *name, const void** data, uint* length); int writefrm(const char* name, const void* data, uint len); int closefrm(TABLE *table); db_type get_table_type(const char *name); db_type get_table_type(THD *thd, const char *name); int read_string(File file, gptr *to, uint length); void free_blobs(TABLE *table); int set_zone(int nr,int min_zone,int max_zone); Loading Loading @@ -1287,7 +1288,7 @@ ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames, const char *newname); ulong next_io_size(ulong pos); void append_unescaped(String *res, const char *pos, uint length); int create_frm(char *name,uint reclength,uchar *fileinfo, int create_frm(THD *thd, char *name,uint reclength,uchar *fileinfo, HA_CREATE_INFO *create_info, uint keys); void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form); int rename_file_ext(const char * from,const char * to,const char * ext); Loading Loading
mysql-test/r/sql_mode.result +18 −0 Original line number Diff line number Diff line Loading @@ -402,4 +402,22 @@ a\b a\"b a'\b a'\"b SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b"; a\b a\'b a"\b a"\'b a\b a\'b a"\b a"\'b set session sql_mode = 'NO_ENGINE_SUBSTITUTION'; create table t1 (a int) engine=isam; ERROR HY000: The 'ISAM' feature is disabled; you need MySQL built with 'ISAM' to have it working show create table t1; ERROR 42S02: Table 'test.t1' doesn't exist drop table if exists t1; Warnings: Note 1051 Unknown table 't1' set session sql_mode = ''; create table t1 (a int) engine=isam; Warnings: Warning 1266 Using storage engine MyISAM for table 't1' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; SET @@SQL_MODE=@OLD_SQL_MODE;
mysql-test/t/sql_mode.test +20 −0 Original line number Diff line number Diff line Loading @@ -189,4 +189,24 @@ SET @@SQL_MODE=''; SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b'; SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b"; # # Bug#6877: MySQL should give an error if the requested table type # is not available # set session sql_mode = 'NO_ENGINE_SUBSTITUTION'; --error 1289 create table t1 (a int) engine=isam; --error 1146 show create table t1; drop table if exists t1; # for comparison, lets see the warnings... set session sql_mode = ''; create table t1 (a int) engine=isam; show create table t1; drop table t1; SET @@SQL_MODE=@OLD_SQL_MODE;
sql/handler.cc +12 −3 Original line number Diff line number Diff line Loading @@ -165,12 +165,22 @@ my_bool ha_storage_engine_is_enabled(enum db_type database_type) /* Use other database handler if databasehandler is not incompiled */ enum db_type ha_checktype(enum db_type database_type) enum db_type ha_checktype(THD *thd, enum db_type database_type, bool no_substitute, bool report_error) { THD *thd; if (ha_storage_engine_is_enabled(database_type)) return database_type; if (no_substitute) { if (report_error) { const char *engine_name= ha_get_storage_engine(database_type); my_error(ER_FEATURE_DISABLED,MYF(0),engine_name,engine_name); } return DB_TYPE_UNKNOWN; } switch (database_type) { #ifndef NO_HASH case DB_TYPE_HASH: Loading @@ -182,7 +192,6 @@ enum db_type ha_checktype(enum db_type database_type) break; } thd= current_thd; return ((enum db_type) thd->variables.table_type != DB_TYPE_UNKNOWN ? (enum db_type) thd->variables.table_type : ((enum db_type) global_system_variables.table_type != Loading
sql/handler.h +2 −1 Original line number Diff line number Diff line Loading @@ -813,7 +813,8 @@ extern ulong total_ha, total_ha_2pc; enum db_type ha_resolve_by_name(const char *name, uint namelen); const char *ha_get_storage_engine(enum db_type db_type); handler *get_new_handler(TABLE *table, enum db_type db_type); enum db_type ha_checktype(enum db_type database_type); enum db_type ha_checktype(THD *thd, enum db_type database_type, bool no_substitute, bool report_error); /* basic stuff */ int ha_init(void); Loading
sql/mysql_priv.h +3 −2 Original line number Diff line number Diff line Loading @@ -325,6 +325,7 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset; #define MODE_TRADITIONAL (MODE_ERROR_FOR_DIVISION_BY_ZERO*2) #define MODE_NO_AUTO_CREATE_USER (MODE_TRADITIONAL*2) #define MODE_HIGH_NOT_PRECEDENCE (MODE_NO_AUTO_CREATE_USER*2) #define MODE_NO_ENGINE_SUBSTITUTION (MODE_HIGH_NOT_PRECEDENCE*2) /* Replication uses 8 bytes to store SQL_MODE in the binary log. The day you use strictly more than 64 bits by adding one more define above, you should Loading Loading @@ -1230,7 +1231,7 @@ int openfrm(THD *thd, const char *name,const char *alias,uint filestat, int readfrm(const char *name, const void** data, uint* length); int writefrm(const char* name, const void* data, uint len); int closefrm(TABLE *table); db_type get_table_type(const char *name); db_type get_table_type(THD *thd, const char *name); int read_string(File file, gptr *to, uint length); void free_blobs(TABLE *table); int set_zone(int nr,int min_zone,int max_zone); Loading Loading @@ -1287,7 +1288,7 @@ ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames, const char *newname); ulong next_io_size(ulong pos); void append_unescaped(String *res, const char *pos, uint length); int create_frm(char *name,uint reclength,uchar *fileinfo, int create_frm(THD *thd, char *name,uint reclength,uchar *fileinfo, HA_CREATE_INFO *create_info, uint keys); void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form); int rename_file_ext(const char * from,const char * to,const char * ext); Loading