Commit 6ec82734 authored by unknown's avatar unknown

Worklog #1280, (Stage 1 Implementation)

This is a starting work to remove handler name dependencies 
from the Lex/Parser.


sql/handler.h:
  WorkLog #1280, Stage 1
sql/lex.h:
  WorkLog #1280, Stage 1
sql/sql_yacc.yy:
  WorkLog #1280, Stage 1
sql/handler.cc:
  Use latin1 for string comparison
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent 2b1dc5f3
...@@ -5,6 +5,7 @@ Administrator@fred. ...@@ -5,6 +5,7 @@ Administrator@fred.
Miguel@light.local Miguel@light.local
Sinisa@sinisa.nasamreza.org Sinisa@sinisa.nasamreza.org
WAX@sergbook.mysql.com WAX@sergbook.mysql.com
acurtis@pcgem.rdg.cyberkinetica.com
administrador@light.hegel.local administrador@light.hegel.local
ahlentz@co3064164-a.rochd1.qld.optusnet.com.au ahlentz@co3064164-a.rochd1.qld.optusnet.com.au
akishkin@work.mysql.com akishkin@work.mysql.com
......
...@@ -70,6 +70,37 @@ const char *tx_isolation_names[] = ...@@ -70,6 +70,37 @@ const char *tx_isolation_names[] =
TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"", TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"",
tx_isolation_names}; tx_isolation_names};
enum db_type ha_resolve_by_name(char *name, uint namelen)
{
enum db_type result = DB_TYPE_UNKNOWN;
if (!my_strcasecmp(&my_charset_latin1, name, "HEAP") ||
!my_strcasecmp(&my_charset_latin1, name, "MEMORY")) {
result = DB_TYPE_HEAP;
} else
if (!my_strcasecmp(&my_charset_latin1, name, "MRG_MYISAM") ||
!my_strcasecmp(&my_charset_latin1, name, "MERGE")) {
result = DB_TYPE_MRG_MYISAM;
} else
if (!my_strcasecmp(&my_charset_latin1, name, "MYISAM")) {
result = DB_TYPE_MYISAM;
} else
if (!my_strcasecmp(&my_charset_latin1, name, "BDB") ||
!my_strcasecmp(&my_charset_latin1, name, "BERKELEYDB")) {
result = DB_TYPE_BERKELEY_DB;
} else
if (!my_strcasecmp(&my_charset_latin1, name, "INNODB") ||
!my_strcasecmp(&my_charset_latin1, name, "INNOBASE")) {
result = DB_TYPE_INNODB;
} else
if (!my_strcasecmp(&my_charset_latin1, name, "ISAM")) {
result = DB_TYPE_ISAM;
} else
if (!my_strcasecmp(&my_charset_latin1, name, "DEFAULT")) {
result = (enum db_type) current_thd->variables.table_type;
}
return result;
}
/* Use other database handler if databasehandler is not incompiled */ /* Use other database handler if databasehandler is not incompiled */
enum db_type ha_checktype(enum db_type database_type) enum db_type ha_checktype(enum db_type database_type)
...@@ -77,18 +108,21 @@ enum db_type ha_checktype(enum db_type database_type) ...@@ -77,18 +108,21 @@ enum db_type ha_checktype(enum db_type database_type)
switch (database_type) { switch (database_type) {
#ifdef HAVE_BERKELEY_DB #ifdef HAVE_BERKELEY_DB
case DB_TYPE_BERKELEY_DB: case DB_TYPE_BERKELEY_DB:
return(berkeley_skip ? DB_TYPE_MYISAM : database_type); if (berkeley_skip) break;
return (database_type);
#endif #endif
#ifdef HAVE_INNOBASE_DB #ifdef HAVE_INNOBASE_DB
case DB_TYPE_INNODB: case DB_TYPE_INNODB:
return(innodb_skip ? DB_TYPE_MYISAM : database_type); if (innodb_skip) break;
return (database_type);
#endif #endif
#ifndef NO_HASH #ifndef NO_HASH
case DB_TYPE_HASH: case DB_TYPE_HASH:
#endif #endif
#ifdef HAVE_ISAM #ifdef HAVE_ISAM
case DB_TYPE_ISAM: case DB_TYPE_ISAM:
return (isam_skip ? DB_TYPE_MYISAM : database_type); if (isam_skip) break;
return (database_type);
case DB_TYPE_MRG_ISAM: case DB_TYPE_MRG_ISAM:
return (isam_skip ? DB_TYPE_MRG_MYISAM : database_type); return (isam_skip ? DB_TYPE_MRG_MYISAM : database_type);
#else #else
...@@ -102,7 +136,8 @@ enum db_type ha_checktype(enum db_type database_type) ...@@ -102,7 +136,8 @@ enum db_type ha_checktype(enum db_type database_type)
default: default:
break; break;
} }
return(DB_TYPE_MYISAM); /* Use this as default */ /* Use this as default */
return((enum db_type) current_thd->variables.table_type);
} /* ha_checktype */ } /* ha_checktype */
......
...@@ -378,6 +378,7 @@ extern TYPELIB ha_table_typelib, tx_isolation_typelib; ...@@ -378,6 +378,7 @@ extern TYPELIB ha_table_typelib, tx_isolation_typelib;
#define ha_supports_generate(T) (T != DB_TYPE_INNODB) #define ha_supports_generate(T) (T != DB_TYPE_INNODB)
enum db_type ha_resolve_by_name(char *name, uint namelen);
handler *get_new_handler(TABLE *table, enum db_type db_type); handler *get_new_handler(TABLE *table, enum db_type db_type);
my_off_t ha_get_ptr(byte *ptr, uint pack_length); my_off_t ha_get_ptr(byte *ptr, uint pack_length);
void ha_store_ptr(byte *buff, uint pack_length, my_off_t pos); void ha_store_ptr(byte *buff, uint pack_length, my_off_t pos);
......
...@@ -194,7 +194,6 @@ static SYMBOL symbols[] = { ...@@ -194,7 +194,6 @@ static SYMBOL symbols[] = {
{ "HAVING", SYM(HAVING),0,0}, { "HAVING", SYM(HAVING),0,0},
{ "HANDLER", SYM(HANDLER_SYM),0,0}, { "HANDLER", SYM(HANDLER_SYM),0,0},
{ "HASH", SYM(HASH_SYM),0,0}, { "HASH", SYM(HASH_SYM),0,0},
{ "HEAP", SYM(HEAP_SYM),0,0},
{ "HELP", SYM(HELP_SYM),0,0}, { "HELP", SYM(HELP_SYM),0,0},
{ "HIGH_PRIORITY", SYM(HIGH_PRIORITY),0,0}, { "HIGH_PRIORITY", SYM(HIGH_PRIORITY),0,0},
{ "HOUR", SYM(HOUR_SYM),0,0}, { "HOUR", SYM(HOUR_SYM),0,0},
...@@ -228,7 +227,6 @@ static SYMBOL symbols[] = { ...@@ -228,7 +227,6 @@ static SYMBOL symbols[] = {
{ "IF", SYM(IF),0,0}, { "IF", SYM(IF),0,0},
{ "IS", SYM(IS),0,0}, { "IS", SYM(IS),0,0},
{ "ISOLATION", SYM(ISOLATION),0,0}, { "ISOLATION", SYM(ISOLATION),0,0},
{ "ISAM", SYM(ISAM_SYM),0,0},
{ "ISSUER", SYM(ISSUER_SYM),0,0}, { "ISSUER", SYM(ISSUER_SYM),0,0},
{ "ITERATE", SYM(ITERATE_SYM),0,0}, { "ITERATE", SYM(ITERATE_SYM),0,0},
{ "JOIN", SYM(JOIN_SYM),0,0}, { "JOIN", SYM(JOIN_SYM),0,0},
...@@ -280,9 +278,7 @@ static SYMBOL symbols[] = { ...@@ -280,9 +278,7 @@ static SYMBOL symbols[] = {
{ "MEDIUMBLOB", SYM(MEDIUMBLOB),0,0}, { "MEDIUMBLOB", SYM(MEDIUMBLOB),0,0},
{ "MEDIUMTEXT", SYM(MEDIUMTEXT),0,0}, { "MEDIUMTEXT", SYM(MEDIUMTEXT),0,0},
{ "MEDIUMINT", SYM(MEDIUMINT),0,0}, { "MEDIUMINT", SYM(MEDIUMINT),0,0},
{ "MERGE", SYM(MERGE_SYM),0,0},
{ "MEDIUM", SYM(MEDIUM_SYM),0,0}, { "MEDIUM", SYM(MEDIUM_SYM),0,0},
{ "MEMORY", SYM(MEMORY_SYM),0,0},
{ "MICROSECOND", SYM(MICROSECOND_SYM),0,0}, { "MICROSECOND", SYM(MICROSECOND_SYM),0,0},
{ "MIDDLEINT", SYM(MEDIUMINT),0,0}, /* For powerbuilder */ { "MIDDLEINT", SYM(MEDIUMINT),0,0}, /* For powerbuilder */
{ "MIN_ROWS", SYM(MIN_ROWS),0,0}, { "MIN_ROWS", SYM(MIN_ROWS),0,0},
...@@ -296,8 +292,6 @@ static SYMBOL symbols[] = { ...@@ -296,8 +292,6 @@ static SYMBOL symbols[] = {
{ "MULTILINESTRING", SYM(MULTILINESTRING),0,0}, { "MULTILINESTRING", SYM(MULTILINESTRING),0,0},
{ "MULTIPOINT", SYM(MULTIPOINT),0,0}, { "MULTIPOINT", SYM(MULTIPOINT),0,0},
{ "MULTIPOLYGON", SYM(MULTIPOLYGON),0,0}, { "MULTIPOLYGON", SYM(MULTIPOLYGON),0,0},
{ "MRG_MYISAM", SYM(MERGE_SYM),0,0},
{ "MYISAM", SYM(MYISAM_SYM),0,0},
{ "NAMES", SYM(NAMES_SYM),0,0}, { "NAMES", SYM(NAMES_SYM),0,0},
{ "NATURAL", SYM(NATURAL),0,0}, { "NATURAL", SYM(NATURAL),0,0},
{ "NATIONAL", SYM(NATIONAL_SYM),0,0}, { "NATIONAL", SYM(NATIONAL_SYM),0,0},
......
...@@ -254,7 +254,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -254,7 +254,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token GROUP %token GROUP
%token HAVING %token HAVING
%token HASH_SYM %token HASH_SYM
%token HEAP_SYM
%token HEX_NUM %token HEX_NUM
%token HIGH_PRIORITY %token HIGH_PRIORITY
%token HOSTS_SYM %token HOSTS_SYM
...@@ -269,7 +268,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -269,7 +268,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token INTO %token INTO
%token IN_SYM %token IN_SYM
%token ISOLATION %token ISOLATION
%token ISAM_SYM
%token JOIN_SYM %token JOIN_SYM
%token KEYS %token KEYS
%token KEY_SYM %token KEY_SYM
...@@ -309,10 +307,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -309,10 +307,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token MAX_QUERIES_PER_HOUR %token MAX_QUERIES_PER_HOUR
%token MAX_UPDATES_PER_HOUR %token MAX_UPDATES_PER_HOUR
%token MEDIUM_SYM %token MEDIUM_SYM
%token MERGE_SYM
%token MEMORY_SYM
%token MIN_ROWS %token MIN_ROWS
%token MYISAM_SYM
%token NAMES_SYM %token NAMES_SYM
%token NATIONAL_SYM %token NATIONAL_SYM
%token NATURAL %token NATURAL
...@@ -1963,13 +1958,14 @@ create_table_option: ...@@ -1963,13 +1958,14 @@ create_table_option:
| INDEX DIRECTORY_SYM opt_equal TEXT_STRING_sys { Lex->create_info.index_file_name= $4.str; }; | INDEX DIRECTORY_SYM opt_equal TEXT_STRING_sys { Lex->create_info.index_file_name= $4.str; };
table_types: table_types:
ISAM_SYM { $$= DB_TYPE_ISAM; } ident_or_text
| MYISAM_SYM { $$= DB_TYPE_MYISAM; } {
| MERGE_SYM { $$= DB_TYPE_MRG_MYISAM; } $$ = ha_resolve_by_name($1.str,$1.length);
| HEAP_SYM { $$= DB_TYPE_HEAP; } if ($$ == DB_TYPE_UNKNOWN) {
| MEMORY_SYM { $$= DB_TYPE_HEAP; } net_printf(YYTHD, ER_UNKNOWN_TABLE, $1.str);
| BERKELEY_DB_SYM { $$= DB_TYPE_BERKELEY_DB; } YYABORT;
| INNOBASE_SYM { $$= DB_TYPE_INNODB; }; }
};
row_types: row_types:
DEFAULT { $$= ROW_TYPE_DEFAULT; } DEFAULT { $$= ROW_TYPE_DEFAULT; }
...@@ -5502,14 +5498,12 @@ keyword: ...@@ -5502,14 +5498,12 @@ keyword:
| GLOBAL_SYM {} | GLOBAL_SYM {}
| HANDLER_SYM {} | HANDLER_SYM {}
| HASH_SYM {} | HASH_SYM {}
| HEAP_SYM {}
| HELP_SYM {} | HELP_SYM {}
| HOSTS_SYM {} | HOSTS_SYM {}
| HOUR_SYM {} | HOUR_SYM {}
| IDENTIFIED_SYM {} | IDENTIFIED_SYM {}
| INDEXES {} | INDEXES {}
| ISOLATION {} | ISOLATION {}
| ISAM_SYM {}
| ISSUER_SYM {} | ISSUER_SYM {}
| INNOBASE_SYM {} | INNOBASE_SYM {}
| INSERT_METHOD {} | INSERT_METHOD {}
...@@ -5540,8 +5534,6 @@ keyword: ...@@ -5540,8 +5534,6 @@ keyword:
| MAX_QUERIES_PER_HOUR {} | MAX_QUERIES_PER_HOUR {}
| MAX_UPDATES_PER_HOUR {} | MAX_UPDATES_PER_HOUR {}
| MEDIUM_SYM {} | MEDIUM_SYM {}
| MERGE_SYM {}
| MEMORY_SYM {}
| MICROSECOND_SYM {} | MICROSECOND_SYM {}
| MINUTE_SYM {} | MINUTE_SYM {}
| MIN_ROWS {} | MIN_ROWS {}
...@@ -5551,7 +5543,6 @@ keyword: ...@@ -5551,7 +5543,6 @@ keyword:
| MULTILINESTRING {} | MULTILINESTRING {}
| MULTIPOINT {} | MULTIPOINT {}
| MULTIPOLYGON {} | MULTIPOLYGON {}
| MYISAM_SYM {}
| NAMES_SYM {} | NAMES_SYM {}
| NATIONAL_SYM {} | NATIONAL_SYM {}
| NCHAR_SYM {} | NCHAR_SYM {}
......
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