Commit 0945dea8 authored by unknown's avatar unknown
Browse files

Merge acurtis@bk-internal.mysql.com:/home/bk/mysql-5.0

into xiphis.org:/usr/home/antony/work2/p3-bug6877.3


sql/mysql_priv.h:
  Auto merged
sql/table.cc:
  Auto merged
parents c0918af2 c25470e3
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -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;
+20 −0
Original line number Diff line number Diff line
@@ -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;
+12 −3
Original line number Diff line number Diff line
@@ -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:
@@ -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 !=
+2 −1
Original line number Diff line number Diff line
@@ -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);
+3 −2
Original line number Diff line number Diff line
@@ -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
@@ -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);
@@ -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