Commit 6cd58f43 authored by lenz@mysql.com's avatar lenz@mysql.com

Merge lgrimmer@build.mysql.com:/home/bk/mysql-4.1

into mysql.com:/space/my/mysql-4.1
parents 80deee25 fa432b3d
...@@ -8,6 +8,7 @@ WAX@sergbook.mysql.com ...@@ -8,6 +8,7 @@ WAX@sergbook.mysql.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
antony@ltantony.rdg.cyberkinetica.homeunix.net
arjen@co3064164-a.bitbike.com arjen@co3064164-a.bitbike.com
arjen@fred.bitbike.com arjen@fred.bitbike.com
arjen@george.bitbike.com arjen@george.bitbike.com
......
...@@ -301,4 +301,5 @@ ...@@ -301,4 +301,5 @@
#define ER_BAD_FT_COLUMN 1282 #define ER_BAD_FT_COLUMN 1282
#define ER_UNKNOWN_KEY_CACHE 1283 #define ER_UNKNOWN_KEY_CACHE 1283
#define ER_WARN_HOSTNAME_WONT_WORK 1284 #define ER_WARN_HOSTNAME_WONT_WORK 1284
#define ER_ERROR_MESSAGES 285 #define ER_UNKNOWN_TABLE_ENGINE 1285
#define ER_ERROR_MESSAGES 286
...@@ -161,3 +161,4 @@ ER_WARN_DATA_OUT_OF_RANGE, "01000", "", ...@@ -161,3 +161,4 @@ ER_WARN_DATA_OUT_OF_RANGE, "01000", "",
ER_WARN_DATA_TRUNCATED, "01000", "", ER_WARN_DATA_TRUNCATED, "01000", "",
ER_WRONG_NAME_FOR_INDEX, "42000", "", ER_WRONG_NAME_FOR_INDEX, "42000", "",
ER_WRONG_NAME_FOR_CATALOG, "42000", "", ER_WRONG_NAME_FOR_CATALOG, "42000", "",
ER_UNKNOWN_TABLE_ENGINE, "42000", "",
...@@ -14,3 +14,16 @@ drop table t1; ...@@ -14,3 +14,16 @@ drop table t1;
create table t1 (a int null); create table t1 (a int null);
insert into t1 values (1),(NULL); insert into t1 values (1),(NULL);
drop table t1; drop table t1;
create table t1 (a int null);
alter table t1 add constraint constraint_1 unique (a);
alter table t1 add constraint unique key_1(a);
alter table t1 add constraint constraint_2 unique key_2(a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) default NULL,
UNIQUE KEY `constraint_1` (`a`),
UNIQUE KEY `key_1` (`a`),
UNIQUE KEY `key_2` (`a`)
) TYPE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
...@@ -201,17 +201,16 @@ t1 CREATE TABLE `t1` ( ...@@ -201,17 +201,16 @@ t1 CREATE TABLE `t1` (
) TYPE=HEAP DEFAULT CHARSET=latin1 ) TYPE=HEAP DEFAULT CHARSET=latin1
drop table t1; drop table t1;
SET SESSION table_type="gemini"; SET SESSION table_type="gemini";
ERROR 42000: Unknown table engine 'gemini'
SELECT @@table_type; SELECT @@table_type;
@@table_type @@table_type
GEMINI HEAP
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
Warnings:
Warning 1265 Using storage engine MYISAM for table 't1'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL default '0'
) TYPE=MyISAM DEFAULT CHARSET=latin1 ) TYPE=HEAP DEFAULT CHARSET=latin1
SET SESSION table_type=default; SET SESSION table_type=default;
drop table t1; drop table t1;
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2)); create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
...@@ -347,17 +346,16 @@ t1 CREATE TABLE `t1` ( ...@@ -347,17 +346,16 @@ t1 CREATE TABLE `t1` (
) TYPE=HEAP DEFAULT CHARSET=latin1 ) TYPE=HEAP DEFAULT CHARSET=latin1
drop table t1; drop table t1;
SET SESSION table_type="gemini"; SET SESSION table_type="gemini";
ERROR 42000: Unknown table engine 'gemini'
SELECT @@table_type; SELECT @@table_type;
@@table_type @@table_type
GEMINI HEAP
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
Warnings:
Warning 1265 Using storage engine MYISAM for table 't1'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL default '0'
) TYPE=MyISAM DEFAULT CHARSET=latin1 ) TYPE=HEAP DEFAULT CHARSET=latin1
SET SESSION table_type=default; SET SESSION table_type=default;
drop table t1; drop table t1;
create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob); create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob);
......
...@@ -121,7 +121,7 @@ Variable_name Value ...@@ -121,7 +121,7 @@ Variable_name Value
table_type HEAP table_type HEAP
show global variables like 'table_type'; show global variables like 'table_type';
Variable_name Value Variable_name Value
table_type INNODB table_type InnoDB
set GLOBAL query_cache_size=100000; set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000; set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size'; show global variables like 'myisam_max_sort_file_size';
...@@ -219,7 +219,7 @@ ERROR HY000: Unknown system variable 'unknown_variable' ...@@ -219,7 +219,7 @@ ERROR HY000: Unknown system variable 'unknown_variable'
set max_join_size="hello"; set max_join_size="hello";
ERROR 42000: Wrong argument type to variable 'max_join_size' ERROR 42000: Wrong argument type to variable 'max_join_size'
set table_type=UNKNOWN_TABLE_TYPE; set table_type=UNKNOWN_TABLE_TYPE;
ERROR 42000: Variable 'table_type' can't be set to the value of 'UNKNOWN_TABLE_TYPE' ERROR 42000: Unknown table engine 'UNKNOWN_TABLE_TYPE'
set table_type=INNODB, big_tables=2; set table_type=INNODB, big_tables=2;
ERROR 42000: Variable 'big_tables' can't be set to the value of '2' ERROR 42000: Variable 'big_tables' can't be set to the value of '2'
show local variables like 'table_type'; show local variables like 'table_type';
......
...@@ -121,8 +121,8 @@ select @@warning_count; ...@@ -121,8 +121,8 @@ select @@warning_count;
drop table t1; drop table t1;
create table t1 (id int) type=isam; create table t1 (id int) type=isam;
Warnings: Warnings:
Warning 1265 Using storage engine MYISAM for table 't1' Warning 1265 Using storage engine MyISAM for table 't1'
alter table t1 type=isam; alter table t1 type=isam;
Warnings: Warnings:
Warning 1265 Using storage engine MYISAM for table 't1' Warning 1265 Using storage engine MyISAM for table 't1'
drop table t1; drop table t1;
...@@ -21,3 +21,9 @@ drop table t1; ...@@ -21,3 +21,9 @@ drop table t1;
create table t1 (a int null); create table t1 (a int null);
insert into t1 values (1),(NULL); insert into t1 values (1),(NULL);
drop table t1; drop table t1;
create table t1 (a int null);
alter table t1 add constraint constraint_1 unique (a);
alter table t1 add constraint unique key_1(a);
alter table t1 add constraint constraint_2 unique key_2(a);
show create table t1;
drop table t1;
...@@ -157,7 +157,7 @@ SELECT @@table_type; ...@@ -157,7 +157,7 @@ SELECT @@table_type;
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
drop table t1; drop table t1;
# Test what happens when using a non existing table type --error 1284
SET SESSION table_type="gemini"; SET SESSION table_type="gemini";
SELECT @@table_type; SELECT @@table_type;
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
...@@ -277,7 +277,7 @@ SELECT @@table_type; ...@@ -277,7 +277,7 @@ SELECT @@table_type;
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
drop table t1; drop table t1;
# Test what happens when using a non existing table type --error 1284
SET SESSION table_type="gemini"; SET SESSION table_type="gemini";
SELECT @@table_type; SELECT @@table_type;
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
......
...@@ -124,7 +124,7 @@ set big_tables="OFFF"; ...@@ -124,7 +124,7 @@ set big_tables="OFFF";
set unknown_variable=1; set unknown_variable=1;
--error 1232 --error 1232
set max_join_size="hello"; set max_join_size="hello";
--error 1231 --error 1284
set table_type=UNKNOWN_TABLE_TYPE; set table_type=UNKNOWN_TABLE_TYPE;
--error 1231 --error 1231
set table_type=INNODB, big_tables=2; set table_type=INNODB, big_tables=2;
......
The MySQL Benchmarks The MySQL Benchmarks
These tests needs a MySQL version of at least 3.20.28 or 3.21.10. These tests require a MySQL version of at least 3.20.28 or 3.21.10. NOTE:
NOTE: With MySQL 3.20.# you have to use '--skip-in', because MySQL 3.20 With MySQL 3.20.x, you must use the --skip-in option, because MySQL 3.20
doesn't support the IN operator. does not support the IN() operator.
Currently the following servers are supported: Currently the following servers are supported:
MySQL 3.20 and 3.21, PostgreSQL 6.#, mSQL 2.# and Solid Server 2.2 MySQL 3.20 and 3.21, PostgreSQL 6.#, mSQL 2.# and Solid Server 2.2
In this directory are the queries and raw data files used to populate The benchmark directory contains the query files and raw data files used to
the MySQL benchmarks. In order to run the benchmarks you should normally populate the MySQL benchmark tables. In order to run the benchmarks, you
execute a command like the following: should normally execute a command such as the following:
run-all-tests --server=mysql --cmp=mysql,pg,solid --user=test --password=test --log run-all-tests --server=mysql --cmp=mysql,pg,solid --user=test --password=test --log
The above means that one wants to run the benchmark with MySQL. The limits This means that you want to run the benchmarks with MySQL. The
should be taken from all of mysql,PostgreSQL and Solid. Login name and limits should be taken from all of MySQL, PostgreSQL, and Solid.
password is 'test'. The result should be saved as a RUN file in the output The login name and password for connecting to the server both are
``test''. The result should be saved as a RUN file in the output
directory. directory.
When the above script has run you will have the individual results and the When run-all-tests has finished, will have the individual results and the
the total RUN- file in the output directory. the total RUN- file in the output directory.
If you want to look at some old results, try: If you want to look at some old results, use the compare-results script.
For example:
compare-results --dir=Results --cmp=mysql,pg,solid compare-results --dir=Results --cmp=mysql,pg,solid
compare-results --dir=Results --cmp=mysql,pg,solid --relative compare-results --dir=Results --cmp=mysql,pg,solid --relative
...@@ -29,8 +31,9 @@ compare-results --dir=Results --cmp=mysql,pg,solid --relative ...@@ -29,8 +31,9 @@ compare-results --dir=Results --cmp=mysql,pg,solid --relative
compare-results --dir=Results --cmp=msql,mysql,pg,solid compare-results --dir=Results --cmp=msql,mysql,pg,solid
compare-results --dir=Results --cmp=msql,mysql,pg,solid --relative compare-results --dir=Results --cmp=msql,mysql,pg,solid --relative
compare-results --dir=results --server=mysql --same-server --cmp=mysql,pg,solid compare-results --dir=Results --server=mysql --same-server --cmp=mysql,pg,solid
Some of the files in the benchmark directory are:
File Description File Description
...@@ -41,15 +44,15 @@ Makefile.am Automake Makefile ...@@ -41,15 +44,15 @@ Makefile.am Automake Makefile
Overview-paper A paper nicked from the net about database bench- Overview-paper A paper nicked from the net about database bench-
marking. marking.
README This file. README This file.
test-ATIS.sh Cretation of 29 tables and a lot of selects on them. test-ATIS.sh Creation of 29 tables and a lot of selects on them.
test-connect.sh Test how fast a connection to the server is. test-connect.sh Test how fast a connection to the server is.
test-create.sh Test how fast a table is created. test-create.sh Test how fast a table is created.
test-insert.sh Test create and fill of a table. test-insert.sh Test create and fill of a table.
test-wisconsin.sh This is a port of the PostgreSQL version of this test-wisconsin.sh This is a port of the PostgreSQL version of this
benchmark. benchmark.
run-all-test Use this to run all tests. When all test are run, run-all-tests Use this to run all tests. When all tests are run,
use the --log --use-old option to get a RUN-file. use the --log --use-old option to get a RUN-file.
compare-results Makes a compare table from different RUN files. compare-results Generates a comparison table from different RUN files.
server-cfg Contains the limit and functions for all supported server-cfg Contains the limit and functions for all supported
SQL servers. If you want to add a new server, this SQL servers. If you want to add a new server, this
should be the only file that neads to be changed. should be the only file that neads to be changed.
...@@ -65,8 +68,8 @@ Useful options to all test-scripts (and run-all-tests): ...@@ -65,8 +68,8 @@ Useful options to all test-scripts (and run-all-tests):
--host=# Hostname for MySQL server (default: localhost) --host=# Hostname for MySQL server (default: localhost)
--db=# Database to use (default: test) --db=# Database to use (default: test)
--fast Allow use of any non-standard SQL extension to --fast Allow use of any non-standard SQL extension to
do the get things done faster. get things done faster.
--skip-in Don't do test with the IN operation (if the SQL server --skip-in Don't do test with the IN() operator (if the SQL server
hasn't implemented this, for example mSQL and MySQL 3.20). hasn't implemented this, for example mSQL and MySQL 3.20).
--lock-tables Use table locking to get more speed. --lock-tables Use table locking to get more speed.
...@@ -81,13 +84,13 @@ systematically measure and compare the performance of relational ...@@ -81,13 +84,13 @@ systematically measure and compare the performance of relational
database systems with database machines. The benchmark is a database systems with database machines. The benchmark is a
single-user and single-factor experiment using a synthetic database single-user and single-factor experiment using a synthetic database
and a controlled workload. It measures the query optimization and a controlled workload. It measures the query optimization
performance of database systems with 32 query types to exe cise the performance of database systems with 32 query types to exercise the
components of the proposed systems. The query suites include components of the proposed systems. The query suites include
selection, join, projection, aggregate, and simple update queries. selection, join, projection, aggregate, and simple update queries.
The test database consists of four generic relations. The tenk The test database consists of four generic relations. The tenk
relation is the key table and most used. Two data types of small relation is the key table and most used. Two data types of small
integer number and character string are utilized. Data values are integer numbers and character strings are utilized. Data values are
uniformly distributed. The primary metric is the query elapsed uniformly distributed. The primary metric is the query elapsed
time. The main criticisms of the benchmark include the nature of time. The main criticisms of the benchmark include the nature of
single-user workload, the simplistic database structure, and the single-user workload, the simplistic database structure, and the
......
...@@ -50,14 +50,33 @@ ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count, ...@@ -50,14 +50,33 @@ ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count,
ha_commit_count, ha_rollback_count, ha_commit_count, ha_rollback_count,
ha_read_rnd_count, ha_read_rnd_next_count; ha_read_rnd_count, ha_read_rnd_next_count;
const char *ha_table_type[] = { static SHOW_COMP_OPTION have_yes= SHOW_OPTION_YES;
"", "DIAB_ISAM","HASH","MISAM","PISAM","RMS_ISAM","HEAP", "ISAM",
"MRG_ISAM","MYISAM", "MRG_MYISAM", "BDB", "INNODB", "GEMINI", "?", "?",NullS
};
TYPELIB ha_table_typelib= struct show_table_type_st sys_table_types[]=
{ {
array_elements(ha_table_type)-3, "", ha_table_type {"MyISAM", &have_yes,
"Default type from 3.23 with great performance", DB_TYPE_MYISAM},
{"HEAP", &have_yes,
"Hash based, stored in memory, useful for temporary tables", DB_TYPE_HEAP},
{"MEMORY", &have_yes,
"Alias for HEAP", DB_TYPE_HEAP},
{"MERGE", &have_yes,
"Collection of identical MyISAM tables", DB_TYPE_MRG_MYISAM},
{"MRG_MYISAM",&have_yes,
"Alias for MERGE", DB_TYPE_MRG_MYISAM},
{"ISAM", &have_isam,
"Obsolete table type; Is replaced by MyISAM", DB_TYPE_ISAM},
{"MRG_ISAM", &have_isam,
"Obsolete table type; Is replaced by MRG_MYISAM", DB_TYPE_MRG_ISAM},
{"InnoDB", &have_innodb,
"Supports transactions, row-level locking and foreign keys", DB_TYPE_INNODB},
{"INNOBASE", &have_innodb,
"Alias for INNODB", DB_TYPE_INNODB},
{"BDB", &have_berkeley_db,
"Supports transactions and page-level locking", DB_TYPE_BERKELEY_DB},
{"BERKELEYDB",&have_berkeley_db,
"Alias for BDB", DB_TYPE_BERKELEY_DB},
{NullS, NULL, NullS, DB_TYPE_UNKNOWN}
}; };
const char *ha_row_type[] = { const char *ha_row_type[] = {
...@@ -70,6 +89,33 @@ const char *tx_isolation_names[] = ...@@ -70,6 +89,33 @@ 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(const char *name, uint namelen)
{
if (!my_strcasecmp(&my_charset_latin1, name, "DEFAULT")) {
return(enum db_type) current_thd->variables.table_type;
}
show_table_type_st *types;
for (types= sys_table_types; types->type; types++)
{
if (!my_strcasecmp(&my_charset_latin1, name, types->type))
return(enum db_type)types->db_type;
}
return DB_TYPE_UNKNOWN;
}
const char *ha_get_table_type(enum db_type db_type)
{
show_table_type_st *types;
for (types= sys_table_types; types->type; types++)
{
if (db_type == types->db_type)
return types->type;
}
return "none";
}
/* 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 +123,21 @@ enum db_type ha_checktype(enum db_type database_type) ...@@ -77,18 +123,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 +151,13 @@ enum db_type ha_checktype(enum db_type database_type) ...@@ -102,7 +151,13 @@ enum db_type ha_checktype(enum db_type database_type)
default: default:
break; break;
} }
return(DB_TYPE_MYISAM); /* Use this as default */
return
DB_TYPE_UNKNOWN != (enum db_type) current_thd->variables.table_type ?
(enum db_type) current_thd->variables.table_type :
DB_TYPE_UNKNOWN != (enum db_type) global_system_variables.table_type ?
(enum db_type) global_system_variables.table_type :
DB_TYPE_MYISAM;
} /* ha_checktype */ } /* ha_checktype */
......
...@@ -131,6 +131,13 @@ enum db_type { DB_TYPE_UNKNOWN=0,DB_TYPE_DIAB_ISAM=1, ...@@ -131,6 +131,13 @@ enum db_type { DB_TYPE_UNKNOWN=0,DB_TYPE_DIAB_ISAM=1,
DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB, DB_TYPE_GEMINI, DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB, DB_TYPE_GEMINI,
DB_TYPE_DEFAULT }; DB_TYPE_DEFAULT };
struct show_table_type_st {
const char *type;
SHOW_COMP_OPTION *value;
const char *comment;
enum db_type db_type;
};
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED, enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED}; ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED};
...@@ -372,8 +379,9 @@ public: ...@@ -372,8 +379,9 @@ public:
/* Some extern variables used with handlers */ /* Some extern variables used with handlers */
extern struct show_table_type_st sys_table_types[];
extern const char *ha_row_type[]; extern const char *ha_row_type[];
extern TYPELIB ha_table_typelib, tx_isolation_typelib; extern TYPELIB tx_isolation_typelib;
/* Wrapper functions */ /* Wrapper functions */
#define ha_commit_stmt(thd) (ha_commit_trans((thd), &((thd)->transaction.stmt))) #define ha_commit_stmt(thd) (ha_commit_trans((thd), &((thd)->transaction.stmt)))
...@@ -383,6 +391,8 @@ extern TYPELIB ha_table_typelib, tx_isolation_typelib; ...@@ -383,6 +391,8 @@ 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(const char *name, uint namelen);
const char *ha_get_table_type(enum db_type db_type);
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);
......
...@@ -580,8 +580,7 @@ int Item_param::save_in_field(Field *field, bool no_conversions) ...@@ -580,8 +580,7 @@ int Item_param::save_in_field(Field *field, bool no_conversions)
{ {
THD *thd= current_thd; THD *thd= current_thd;
if (thd->command == COM_PREPARE) DBUG_ASSERT(thd->command == COM_EXECUTE);
return -1;
if (null_value) if (null_value)
return (int) set_field_to_null(field); return (int) set_field_to_null(field);
......
...@@ -186,7 +186,6 @@ static SYMBOL symbols[] = { ...@@ -186,7 +186,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},
...@@ -219,7 +218,6 @@ static SYMBOL symbols[] = { ...@@ -219,7 +218,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},
{ "JOIN", SYM(JOIN_SYM),0,0}, { "JOIN", SYM(JOIN_SYM),0,0},
{ "KEY", SYM(KEY_SYM),0,0}, { "KEY", SYM(KEY_SYM),0,0},
...@@ -268,9 +266,7 @@ static SYMBOL symbols[] = { ...@@ -268,9 +266,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},
...@@ -284,8 +280,6 @@ static SYMBOL symbols[] = { ...@@ -284,8 +280,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},
......
...@@ -860,7 +860,6 @@ extern MY_BITMAP temp_pool; ...@@ -860,7 +860,6 @@ extern MY_BITMAP temp_pool;
extern String my_empty_string; extern String my_empty_string;
extern String my_null_string; extern String my_null_string;
extern SHOW_VAR init_vars[],status_vars[], internal_vars[]; extern SHOW_VAR init_vars[],status_vars[], internal_vars[];
extern struct show_table_type_st table_type_vars[];
extern SHOW_COMP_OPTION have_isam; extern SHOW_COMP_OPTION have_isam;
extern SHOW_COMP_OPTION have_innodb; extern SHOW_COMP_OPTION have_innodb;
extern SHOW_COMP_OPTION have_berkeley_db; extern SHOW_COMP_OPTION have_berkeley_db;
......
...@@ -5403,13 +5403,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -5403,13 +5403,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
case OPT_TABLE_TYPE: case OPT_TABLE_TYPE:
{ {
int type; if ((enum db_type)((global_system_variables.table_type=
if ((type=find_type(argument, &ha_table_typelib, 2)) <= 0) ha_resolve_by_name(argument, strlen(argument)))) == DB_TYPE_UNKNOWN)
{ {
fprintf(stderr,"Unknown table type: %s\n",argument); fprintf(stderr,"Unknown table type: %s\n",argument);
exit(1); exit(1);
} }
global_system_variables.table_type= type-1;
break; break;
} }
case OPT_SERVER_ID: case OPT_SERVER_ID:
......
...@@ -284,8 +284,8 @@ sys_var_thd_ulong sys_sort_buffer("sort_buffer_size", ...@@ -284,8 +284,8 @@ sys_var_thd_ulong sys_sort_buffer("sort_buffer_size",
&SV::sortbuff_size); &SV::sortbuff_size);
sys_var_thd_sql_mode sys_sql_mode("sql_mode", sys_var_thd_sql_mode sys_sql_mode("sql_mode",
&SV::sql_mode); &SV::sql_mode);
sys_var_thd_enum sys_table_type("table_type", &SV::table_type, sys_var_thd_table_type sys_table_type("table_type",
&ha_table_typelib); &SV::table_type);
sys_var_long_ptr sys_table_cache_size("table_cache", sys_var_long_ptr sys_table_cache_size("table_cache",
&table_cache_size); &table_cache_size);
sys_var_long_ptr sys_thread_cache_size("thread_cache_size", sys_var_long_ptr sys_thread_cache_size("thread_cache_size",
...@@ -2408,6 +2408,61 @@ int set_var_password::update(THD *thd) ...@@ -2408,6 +2408,61 @@ int set_var_password::update(THD *thd)
#endif #endif
} }
/****************************************************************************
Functions to handle table_type
****************************************************************************/
bool sys_var_thd_table_type::check(THD *thd, set_var *var)
/* Based upon sys_var::check_enum() */
{
char buff[80];
const char *value;
String str(buff, sizeof(buff), &my_charset_latin1), *res;
if (var->value->result_type() == STRING_RESULT)
{
if (!(res=var->value->val_str(&str)) ||
!(var->save_result.ulong_value=
(ulong) ha_resolve_by_name(res->ptr(), res->length())))
{
value= res ? res->c_ptr() : "NULL";
goto err;
}
return 0;
}
err:
my_error(ER_UNKNOWN_TABLE_ENGINE, MYF(0), value);
return 1;
}
byte *sys_var_thd_table_type::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
ulong val;
val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
thd->variables.*offset);
const char *table_type= ha_get_table_type((enum db_type)val);
return (byte *)table_type;
}
void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
global_system_variables.*offset= (ulong) DB_TYPE_MYISAM;
else
thd->variables.*offset= (ulong) (global_system_variables.*offset);
}
bool sys_var_thd_table_type::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
global_system_variables.*offset= var->save_result.ulong_value;
else
thd->variables.*offset= var->save_result.ulong_value;
return 0;
}
/**************************************************************************** /****************************************************************************
Functions to handle sql_mode Functions to handle sql_mode
****************************************************************************/ ****************************************************************************/
......
...@@ -343,6 +343,26 @@ public: ...@@ -343,6 +343,26 @@ public:
}; };
class sys_var_thd_table_type :public sys_var_thd
{
protected:
ulong SV::*offset;
public:
sys_var_thd_table_type(const char *name_arg, ulong SV::*offset_arg)
:sys_var_thd(name_arg), offset(offset_arg)
{}
bool check(THD *thd, set_var *var);
SHOW_TYPE type() { return SHOW_CHAR; }
bool check_update_type(Item_result type)
{
return type != STRING_RESULT; /* Only accept strings */
}
void set_default(THD *thd, enum_var_type type);
bool update(THD *thd, set_var *var);
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
class sys_var_thd_bit :public sys_var_thd class sys_var_thd_bit :public sys_var_thd
{ {
sys_update_func update_func; sys_update_func update_func;
......
...@@ -297,3 +297,4 @@ character-set=latin2 ...@@ -297,3 +297,4 @@ character-set=latin2
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -291,3 +291,4 @@ character-set=latin1 ...@@ -291,3 +291,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -299,3 +299,4 @@ character-set=latin1 ...@@ -299,3 +299,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -288,3 +288,4 @@ character-set=latin1 ...@@ -288,3 +288,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -293,3 +293,4 @@ character-set=latin7 ...@@ -293,3 +293,4 @@ character-set=latin7
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -288,3 +288,4 @@ character-set=latin1 ...@@ -288,3 +288,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -300,3 +300,4 @@ character-set=latin1 ...@@ -300,3 +300,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -288,3 +288,4 @@ character-set=greek ...@@ -288,3 +288,4 @@ character-set=greek
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -290,3 +290,4 @@ character-set=latin2 ...@@ -290,3 +290,4 @@ character-set=latin2
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -288,3 +288,4 @@ character-set=latin1 ...@@ -288,3 +288,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -290,3 +290,4 @@ character-set=ujis ...@@ -290,3 +290,4 @@ character-set=ujis
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -288,3 +288,4 @@ character-set=euckr ...@@ -288,3 +288,4 @@ character-set=euckr
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -290,3 +290,4 @@ character-set=latin1 ...@@ -290,3 +290,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -290,3 +290,4 @@ character-set=latin1 ...@@ -290,3 +290,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -292,3 +292,4 @@ character-set=latin2 ...@@ -292,3 +292,4 @@ character-set=latin2
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -289,3 +289,4 @@ character-set=latin1 ...@@ -289,3 +289,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -292,3 +292,4 @@ character-set=latin2 ...@@ -292,3 +292,4 @@ character-set=latin2
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -290,3 +290,4 @@ character-set=koi8r ...@@ -290,3 +290,4 @@ character-set=koi8r
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -283,3 +283,4 @@ character-set=cp1250 ...@@ -283,3 +283,4 @@ character-set=cp1250
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -296,3 +296,4 @@ character-set=latin2 ...@@ -296,3 +296,4 @@ character-set=latin2
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -290,3 +290,4 @@ character-set=latin1 ...@@ -290,3 +290,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -288,3 +288,4 @@ character-set=latin1 ...@@ -288,3 +288,4 @@ character-set=latin1
"Kolumn '%-.64s' kan inte vara del av ett FULLTEXT index", "Kolumn '%-.64s' kan inte vara del av ett FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -293,3 +293,4 @@ character-set=koi8u ...@@ -293,3 +293,4 @@ character-set=koi8u
"Column '%-.64s' cannot be part of FULLTEXT index", "Column '%-.64s' cannot be part of FULLTEXT index",
"Unknown key cache '%-.100s'", "Unknown key cache '%-.100s'",
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work", "MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",
"Unknown table engine '%s'",
...@@ -173,33 +173,6 @@ int mysqld_show_tables(THD *thd,const char *db,const char *wild) ...@@ -173,33 +173,6 @@ int mysqld_show_tables(THD *thd,const char *db,const char *wild)
** List all table types supported ** List all table types supported
***************************************************************************/ ***************************************************************************/
struct show_table_type_st {
const char *type;
SHOW_COMP_OPTION *value;
const char *comment;
};
SHOW_COMP_OPTION have_yes= SHOW_OPTION_YES;
static struct show_table_type_st sys_table_types[]=
{
{"MyISAM", &have_yes,
"Default type from 3.23 with great performance"},
{"HEAP" , &have_yes,
"Hash based, stored in memory, useful for temporary tables"},
{"MERGE", &have_yes,
"Collection of identical MyISAM tables"},
{"ISAM", &have_isam,
"Obsolete table type; Is replaced by MyISAM"},
{"InnoDB", &have_innodb,
"Supports transactions, row-level locking and foreign keys"},
{"BDB", &have_berkeley_db,
"Supports transactions and page-level locking"},
{NullS, NULL, NullS}
};
int mysqld_show_table_types(THD *thd) int mysqld_show_table_types(THD *thd)
{ {
List<Item> field_list; List<Item> field_list;
...@@ -214,7 +187,7 @@ int mysqld_show_table_types(THD *thd) ...@@ -214,7 +187,7 @@ int mysqld_show_table_types(THD *thd)
DBUG_RETURN(1); DBUG_RETURN(1);
const char *default_type_name= const char *default_type_name=
ha_table_typelib.type_names[thd->variables.table_type]; ha_get_table_type((enum db_type)thd->variables.table_type);
show_table_type_st *types; show_table_type_st *types;
for (types= sys_table_types; types->type; types++) for (types= sys_table_types; types->type; types++)
......
...@@ -404,7 +404,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, ...@@ -404,7 +404,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_USING_OTHER_HANDLER, ER_WARN_USING_OTHER_HANDLER,
ER(ER_WARN_USING_OTHER_HANDLER), ER(ER_WARN_USING_OTHER_HANDLER),
ha_table_typelib.type_names[new_db_type], ha_get_table_type(new_db_type),
table_name); table_name);
} }
db_options=create_info->table_options; db_options=create_info->table_options;
...@@ -2016,7 +2016,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -2016,7 +2016,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_USING_OTHER_HANDLER, ER_WARN_USING_OTHER_HANDLER,
ER(ER_WARN_USING_OTHER_HANDLER), ER(ER_WARN_USING_OTHER_HANDLER),
ha_table_typelib.type_names[new_db_type], ha_get_table_type(new_db_type),
new_name); new_name);
} }
if (create_info->row_type == ROW_TYPE_NOT_USED) if (create_info->row_type == ROW_TYPE_NOT_USED)
......
...@@ -241,7 +241,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -241,7 +241,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
...@@ -257,7 +256,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -257,7 +256,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
...@@ -296,10 +294,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -296,10 +294,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
...@@ -598,7 +593,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -598,7 +593,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%type <simple_string> %type <simple_string>
remember_name remember_end opt_ident opt_db text_or_password remember_name remember_end opt_ident opt_db text_or_password
opt_escape opt_escape opt_constraint
%type <string> %type <string>
text_string opt_gconcat_separator text_string opt_gconcat_separator
...@@ -631,7 +626,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -631,7 +626,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
expr_list udf_expr_list when_list ident_list ident_list_arg expr_list udf_expr_list when_list ident_list ident_list_arg
%type <key_type> %type <key_type>
key_type opt_unique_or_fulltext key_type opt_unique_or_fulltext constraint_key_type
%type <key_alg> %type <key_alg>
key_alg opt_btree_or_rtree key_alg opt_btree_or_rtree
...@@ -1126,13 +1121,14 @@ create_table_option: ...@@ -1126,13 +1121,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_ENGINE, $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; }
...@@ -1189,6 +1185,13 @@ key_def: ...@@ -1189,6 +1185,13 @@ key_def:
lex->key_list.push_back(new Key($1,$2, $3, lex->col_list)); lex->key_list.push_back(new Key($1,$2, $3, lex->col_list));
lex->col_list.empty(); /* Alloced by sql_alloc */ lex->col_list.empty(); /* Alloced by sql_alloc */
} }
| opt_constraint constraint_key_type opt_ident key_alg '(' key_list ')'
{
LEX *lex=Lex;
const char *key_name= $3 ? $3:$1;
lex->key_list.push_back(new Key($2, key_name, $4, lex->col_list));
lex->col_list.empty(); /* Alloced by sql_alloc */
}
| opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references | opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
{ {
LEX *lex=Lex; LEX *lex=Lex;
...@@ -1212,8 +1215,8 @@ check_constraint: ...@@ -1212,8 +1215,8 @@ check_constraint:
; ;
opt_constraint: opt_constraint:
/* empty */ /* empty */ { $$=(char*) 0; }
| CONSTRAINT opt_ident; | CONSTRAINT opt_ident { $$=$2; };
field_spec: field_spec:
field_ident field_ident
...@@ -1575,14 +1578,16 @@ delete_option: ...@@ -1575,14 +1578,16 @@ delete_option:
| SET DEFAULT { $$= (int) foreign_key::FK_OPTION_DEFAULT; }; | SET DEFAULT { $$= (int) foreign_key::FK_OPTION_DEFAULT; };
key_type: key_type:
opt_constraint PRIMARY_SYM KEY_SYM { $$= Key::PRIMARY; } key_or_index { $$= Key::MULTIPLE; }
| key_or_index { $$= Key::MULTIPLE; }
| FULLTEXT_SYM { $$= Key::FULLTEXT; } | FULLTEXT_SYM { $$= Key::FULLTEXT; }
| FULLTEXT_SYM key_or_index { $$= Key::FULLTEXT; } | FULLTEXT_SYM key_or_index { $$= Key::FULLTEXT; }
| SPATIAL_SYM { $$= Key::SPATIAL; } | SPATIAL_SYM { $$= Key::SPATIAL; }
| SPATIAL_SYM key_or_index { $$= Key::SPATIAL; } | SPATIAL_SYM key_or_index { $$= Key::SPATIAL; };
| opt_constraint UNIQUE_SYM { $$= Key::UNIQUE; }
| opt_constraint UNIQUE_SYM key_or_index { $$= Key::UNIQUE; }; constraint_key_type:
PRIMARY_SYM KEY_SYM { $$= Key::PRIMARY; }
| UNIQUE_SYM { $$= Key::UNIQUE; }
| UNIQUE_SYM key_or_index { $$= Key::UNIQUE; };
key_or_index: key_or_index:
KEY_SYM {} KEY_SYM {}
...@@ -4633,7 +4638,6 @@ keyword: ...@@ -4633,7 +4638,6 @@ 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 {}
...@@ -4641,7 +4645,6 @@ keyword: ...@@ -4641,7 +4645,6 @@ keyword:
| IMPORT {} | IMPORT {}
| INDEXES {} | INDEXES {}
| ISOLATION {} | ISOLATION {}
| ISAM_SYM {}
| ISSUER_SYM {} | ISSUER_SYM {}
| INNOBASE_SYM {} | INNOBASE_SYM {}
| INSERT_METHOD {} | INSERT_METHOD {}
...@@ -4672,8 +4675,6 @@ keyword: ...@@ -4672,8 +4675,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 {}
...@@ -4683,7 +4684,6 @@ keyword: ...@@ -4683,7 +4684,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