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
administrador@light.hegel.local
ahlentz@co3064164-a.rochd1.qld.optusnet.com.au
akishkin@work.mysql.com
antony@ltantony.rdg.cyberkinetica.homeunix.net
arjen@co3064164-a.bitbike.com
arjen@fred.bitbike.com
arjen@george.bitbike.com
......
......@@ -301,4 +301,5 @@
#define ER_BAD_FT_COLUMN 1282
#define ER_UNKNOWN_KEY_CACHE 1283
#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", "",
ER_WARN_DATA_TRUNCATED, "01000", "",
ER_WRONG_NAME_FOR_INDEX, "42000", "",
ER_WRONG_NAME_FOR_CATALOG, "42000", "",
ER_UNKNOWN_TABLE_ENGINE, "42000", "",
......@@ -14,3 +14,16 @@ drop table t1;
create table t1 (a int null);
insert into t1 values (1),(NULL);
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` (
) TYPE=HEAP DEFAULT CHARSET=latin1
drop table t1;
SET SESSION table_type="gemini";
ERROR 42000: Unknown table engine 'gemini'
SELECT @@table_type;
@@table_type
GEMINI
HEAP
CREATE TABLE t1 (a int not null);
Warnings:
Warning 1265 Using storage engine MYISAM for table 't1'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
) TYPE=MyISAM DEFAULT CHARSET=latin1
) TYPE=HEAP DEFAULT CHARSET=latin1
SET SESSION table_type=default;
drop table t1;
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
......@@ -347,17 +346,16 @@ t1 CREATE TABLE `t1` (
) TYPE=HEAP DEFAULT CHARSET=latin1
drop table t1;
SET SESSION table_type="gemini";
ERROR 42000: Unknown table engine 'gemini'
SELECT @@table_type;
@@table_type
GEMINI
HEAP
CREATE TABLE t1 (a int not null);
Warnings:
Warning 1265 Using storage engine MYISAM for table 't1'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
) TYPE=MyISAM DEFAULT CHARSET=latin1
) TYPE=HEAP DEFAULT CHARSET=latin1
SET SESSION table_type=default;
drop table t1;
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
table_type HEAP
show global variables like 'table_type';
Variable_name Value
table_type INNODB
table_type InnoDB
set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size';
......@@ -219,7 +219,7 @@ ERROR HY000: Unknown system variable 'unknown_variable'
set max_join_size="hello";
ERROR 42000: Wrong argument type to variable 'max_join_size'
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;
ERROR 42000: Variable 'big_tables' can't be set to the value of '2'
show local variables like 'table_type';
......
......@@ -121,8 +121,8 @@ select @@warning_count;
drop table t1;
create table t1 (id int) type=isam;
Warnings:
Warning 1265 Using storage engine MYISAM for table 't1'
Warning 1265 Using storage engine MyISAM for table 't1'
alter table t1 type=isam;
Warnings:
Warning 1265 Using storage engine MYISAM for table 't1'
Warning 1265 Using storage engine MyISAM for table 't1'
drop table t1;
......@@ -21,3 +21,9 @@ drop table t1;
create table t1 (a int null);
insert into t1 values (1),(NULL);
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;
CREATE TABLE t1 (a int not null);
show create table t1;
drop table t1;
# Test what happens when using a non existing table type
--error 1284
SET SESSION table_type="gemini";
SELECT @@table_type;
CREATE TABLE t1 (a int not null);
......@@ -277,7 +277,7 @@ SELECT @@table_type;
CREATE TABLE t1 (a int not null);
show create table t1;
drop table t1;
# Test what happens when using a non existing table type
--error 1284
SET SESSION table_type="gemini";
SELECT @@table_type;
CREATE TABLE t1 (a int not null);
......
......@@ -124,7 +124,7 @@ set big_tables="OFFF";
set unknown_variable=1;
--error 1232
set max_join_size="hello";
--error 1231
--error 1284
set table_type=UNKNOWN_TABLE_TYPE;
--error 1231
set table_type=INNODB, big_tables=2;
......
The MySQL Benchmarks
These tests needs a MySQL version of at least 3.20.28 or 3.21.10.
NOTE: With MySQL 3.20.# you have to use '--skip-in', because MySQL 3.20
doesn't support the IN operator.
These tests require a MySQL version of at least 3.20.28 or 3.21.10. NOTE:
With MySQL 3.20.x, you must use the --skip-in option, because MySQL 3.20
does not support the IN() operator.
Currently the following servers are supported:
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 MySQL benchmarks. In order to run the benchmarks you should normally
execute a command like the following:
The benchmark directory contains the query files and raw data files used to
populate the MySQL benchmark tables. In order to run the benchmarks, you
should normally execute a command such as the following:
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
should be taken from all of mysql,PostgreSQL and Solid. Login name and
password is 'test'. The result should be saved as a RUN file in the output
This means that you want to run the benchmarks with MySQL. The
limits should be taken from all of MySQL, PostgreSQL, and Solid.
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.
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.
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 --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 --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
......@@ -41,15 +44,15 @@ Makefile.am Automake Makefile
Overview-paper A paper nicked from the net about database bench-
marking.
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-create.sh Test how fast a table is created.
test-insert.sh Test create and fill of a table.
test-wisconsin.sh This is a port of the PostgreSQL version of this
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.
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
SQL servers. If you want to add a new server, this
should be the only file that neads to be changed.
......@@ -65,8 +68,8 @@ Useful options to all test-scripts (and run-all-tests):
--host=# Hostname for MySQL server (default: localhost)
--db=# Database to use (default: test)
--fast Allow use of any non-standard SQL extension to
do the get things done faster.
--skip-in Don't do test with the IN operation (if the SQL server
get things done faster.
--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).
--lock-tables Use table locking to get more speed.
......@@ -81,13 +84,13 @@ systematically measure and compare the performance of relational
database systems with database machines. The benchmark is a
single-user and single-factor experiment using a synthetic database
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
selection, join, projection, aggregate, and simple update queries.
The test database consists of four generic relations. The tenk
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
time. The main criticisms of the benchmark include the nature of
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,
ha_commit_count, ha_rollback_count,
ha_read_rnd_count, ha_read_rnd_next_count;
const char *ha_table_type[] = {
"", "DIAB_ISAM","HASH","MISAM","PISAM","RMS_ISAM","HEAP", "ISAM",
"MRG_ISAM","MYISAM", "MRG_MYISAM", "BDB", "INNODB", "GEMINI", "?", "?",NullS
};
static SHOW_COMP_OPTION have_yes= SHOW_OPTION_YES;
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[] = {
......@@ -70,6 +89,33 @@ const char *tx_isolation_names[] =
TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"",
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 */
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) {
#ifdef HAVE_BERKELEY_DB
case DB_TYPE_BERKELEY_DB:
return(berkeley_skip ? DB_TYPE_MYISAM : database_type);
if (berkeley_skip) break;
return (database_type);
#endif
#ifdef HAVE_INNOBASE_DB
case DB_TYPE_INNODB:
return(innodb_skip ? DB_TYPE_MYISAM : database_type);
if (innodb_skip) break;
return (database_type);
#endif
#ifndef NO_HASH
case DB_TYPE_HASH:
#endif
#ifdef HAVE_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:
return (isam_skip ? DB_TYPE_MRG_MYISAM : database_type);
#else
......@@ -102,7 +151,13 @@ enum db_type ha_checktype(enum db_type database_type)
default:
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 */
......
......@@ -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_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,
ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED};
......@@ -372,8 +379,9 @@ class handler :public Sql_alloc
/* Some extern variables used with handlers */
extern struct show_table_type_st sys_table_types[];
extern const char *ha_row_type[];
extern TYPELIB ha_table_typelib, tx_isolation_typelib;
extern TYPELIB tx_isolation_typelib;
/* Wrapper functions */
#define ha_commit_stmt(thd) (ha_commit_trans((thd), &((thd)->transaction.stmt)))
......@@ -383,6 +391,8 @@ extern TYPELIB ha_table_typelib, tx_isolation_typelib;
#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);
my_off_t ha_get_ptr(byte *ptr, uint pack_length);
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)
{
THD *thd= current_thd;
if (thd->command == COM_PREPARE)
return -1;
DBUG_ASSERT(thd->command == COM_EXECUTE);
if (null_value)
return (int) set_field_to_null(field);
......
......@@ -186,7 +186,6 @@ static SYMBOL symbols[] = {
{ "HAVING", SYM(HAVING),0,0},
{ "HANDLER", SYM(HANDLER_SYM),0,0},
{ "HASH", SYM(HASH_SYM),0,0},
{ "HEAP", SYM(HEAP_SYM),0,0},
{ "HELP", SYM(HELP_SYM),0,0},
{ "HIGH_PRIORITY", SYM(HIGH_PRIORITY),0,0},
{ "HOUR", SYM(HOUR_SYM),0,0},
......@@ -219,7 +218,6 @@ static SYMBOL symbols[] = {
{ "IF", SYM(IF),0,0},
{ "IS", SYM(IS),0,0},
{ "ISOLATION", SYM(ISOLATION),0,0},
{ "ISAM", SYM(ISAM_SYM),0,0},
{ "ISSUER", SYM(ISSUER_SYM),0,0},
{ "JOIN", SYM(JOIN_SYM),0,0},
{ "KEY", SYM(KEY_SYM),0,0},
......@@ -268,9 +266,7 @@ static SYMBOL symbols[] = {
{ "MEDIUMBLOB", SYM(MEDIUMBLOB),0,0},
{ "MEDIUMTEXT", SYM(MEDIUMTEXT),0,0},
{ "MEDIUMINT", SYM(MEDIUMINT),0,0},
{ "MERGE", SYM(MERGE_SYM),0,0},
{ "MEDIUM", SYM(MEDIUM_SYM),0,0},
{ "MEMORY", SYM(MEMORY_SYM),0,0},
{ "MICROSECOND", SYM(MICROSECOND_SYM),0,0},
{ "MIDDLEINT", SYM(MEDIUMINT),0,0}, /* For powerbuilder */
{ "MIN_ROWS", SYM(MIN_ROWS),0,0},
......@@ -284,8 +280,6 @@ static SYMBOL symbols[] = {
{ "MULTILINESTRING", SYM(MULTILINESTRING),0,0},
{ "MULTIPOINT", SYM(MULTIPOINT),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},
{ "NATURAL", SYM(NATURAL),0,0},
{ "NATIONAL", SYM(NATIONAL_SYM),0,0},
......
......@@ -860,7 +860,6 @@ extern MY_BITMAP temp_pool;
extern String my_empty_string;
extern String my_null_string;
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_innodb;
extern SHOW_COMP_OPTION have_berkeley_db;
......
......@@ -5403,13 +5403,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case OPT_TABLE_TYPE:
{
int type;
if ((type=find_type(argument, &ha_table_typelib, 2)) <= 0)
if ((enum db_type)((global_system_variables.table_type=
ha_resolve_by_name(argument, strlen(argument)))) == DB_TYPE_UNKNOWN)
{
fprintf(stderr,"Unknown table type: %s\n",argument);
exit(1);
}
global_system_variables.table_type= type-1;
break;
}
case OPT_SERVER_ID:
......
......@@ -284,8 +284,8 @@ sys_var_thd_ulong sys_sort_buffer("sort_buffer_size",
&SV::sortbuff_size);
sys_var_thd_sql_mode sys_sql_mode("sql_mode",
&SV::sql_mode);
sys_var_thd_enum sys_table_type("table_type", &SV::table_type,
&ha_table_typelib);
sys_var_thd_table_type sys_table_type("table_type",
&SV::table_type);
sys_var_long_ptr sys_table_cache_size("table_cache",
&table_cache_size);
sys_var_long_ptr sys_thread_cache_size("thread_cache_size",
......@@ -2408,6 +2408,61 @@ int set_var_password::update(THD *thd)
#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
****************************************************************************/
......
......@@ -343,6 +343,26 @@ class sys_var_thd_sql_mode :public sys_var_thd_enum
};
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
{
sys_update_func update_func;
......
......@@ -297,3 +297,4 @@ character-set=latin2
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -291,3 +291,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -299,3 +299,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -288,3 +288,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -293,3 +293,4 @@ character-set=latin7
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -288,3 +288,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -300,3 +300,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -288,3 +288,4 @@ character-set=greek
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -290,3 +290,4 @@ character-set=latin2
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -288,3 +288,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -290,3 +290,4 @@ character-set=ujis
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -288,3 +288,4 @@ character-set=euckr
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -290,3 +290,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -290,3 +290,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -292,3 +292,4 @@ character-set=latin2
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -289,3 +289,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -292,3 +292,4 @@ character-set=latin2
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -290,3 +290,4 @@ character-set=koi8r
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -283,3 +283,4 @@ character-set=cp1250
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -296,3 +296,4 @@ character-set=latin2
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -290,3 +290,4 @@ character-set=latin1
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -288,3 +288,4 @@ character-set=latin1
"Kolumn '%-.64s' kan inte vara del av ett FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -293,3 +293,4 @@ character-set=koi8u
"Column '%-.64s' cannot be part of FULLTEXT index",
"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",
"Unknown table engine '%s'",
......@@ -173,33 +173,6 @@ int mysqld_show_tables(THD *thd,const char *db,const char *wild)
** 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)
{
List<Item> field_list;
......@@ -213,8 +186,8 @@ int mysqld_show_table_types(THD *thd)
if (protocol->send_fields(&field_list,1))
DBUG_RETURN(1);
const char *default_type_name=
ha_table_typelib.type_names[thd->variables.table_type];
const char *default_type_name=
ha_get_table_type((enum db_type)thd->variables.table_type);
show_table_type_st *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,
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
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);
}
db_options=create_info->table_options;
......@@ -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,
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);
}
if (create_info->row_type == ROW_TYPE_NOT_USED)
......
......@@ -241,7 +241,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token GROUP
%token HAVING
%token HASH_SYM
%token HEAP_SYM
%token HEX_NUM
%token HIGH_PRIORITY
%token HOSTS_SYM
......@@ -257,7 +256,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token INTO
%token IN_SYM
%token ISOLATION
%token ISAM_SYM
%token JOIN_SYM
%token KEYS
%token KEY_SYM
......@@ -296,10 +294,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token MAX_QUERIES_PER_HOUR
%token MAX_UPDATES_PER_HOUR
%token MEDIUM_SYM
%token MERGE_SYM
%token MEMORY_SYM
%token MIN_ROWS
%token MYISAM_SYM
%token NAMES_SYM
%token NATIONAL_SYM
%token NATURAL
......@@ -598,7 +593,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%type <simple_string>
remember_name remember_end opt_ident opt_db text_or_password
opt_escape
opt_escape opt_constraint
%type <string>
text_string opt_gconcat_separator
......@@ -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
%type <key_type>
key_type opt_unique_or_fulltext
key_type opt_unique_or_fulltext constraint_key_type
%type <key_alg>
key_alg opt_btree_or_rtree
......@@ -1126,13 +1121,14 @@ create_table_option:
| INDEX DIRECTORY_SYM opt_equal TEXT_STRING_sys { Lex->create_info.index_file_name= $4.str; };
table_types:
ISAM_SYM { $$= DB_TYPE_ISAM; }
| MYISAM_SYM { $$= DB_TYPE_MYISAM; }
| MERGE_SYM { $$= DB_TYPE_MRG_MYISAM; }
| HEAP_SYM { $$= DB_TYPE_HEAP; }
| MEMORY_SYM { $$= DB_TYPE_HEAP; }
| BERKELEY_DB_SYM { $$= DB_TYPE_BERKELEY_DB; }
| INNOBASE_SYM { $$= DB_TYPE_INNODB; };
ident_or_text
{
$$ = ha_resolve_by_name($1.str,$1.length);
if ($$ == DB_TYPE_UNKNOWN) {
net_printf(YYTHD, ER_UNKNOWN_TABLE_ENGINE, $1.str);
YYABORT;
}
};
row_types:
DEFAULT { $$= ROW_TYPE_DEFAULT; }
......@@ -1189,6 +1185,13 @@ key_def:
lex->key_list.push_back(new Key($1,$2, $3, lex->col_list));
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
{
LEX *lex=Lex;
......@@ -1212,8 +1215,8 @@ check_constraint:
;
opt_constraint:
/* empty */
| CONSTRAINT opt_ident;
/* empty */ { $$=(char*) 0; }
| CONSTRAINT opt_ident { $$=$2; };
field_spec:
field_ident
......@@ -1575,14 +1578,16 @@ delete_option:
| SET DEFAULT { $$= (int) foreign_key::FK_OPTION_DEFAULT; };
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_or_index { $$= Key::FULLTEXT; }
| SPATIAL_SYM { $$= Key::SPATIAL; }
| SPATIAL_SYM key_or_index { $$= Key::SPATIAL; }
| opt_constraint UNIQUE_SYM { $$= Key::UNIQUE; }
| opt_constraint UNIQUE_SYM key_or_index { $$= Key::UNIQUE; };
| SPATIAL_SYM key_or_index { $$= Key::SPATIAL; };
constraint_key_type:
PRIMARY_SYM KEY_SYM { $$= Key::PRIMARY; }
| UNIQUE_SYM { $$= Key::UNIQUE; }
| UNIQUE_SYM key_or_index { $$= Key::UNIQUE; };
key_or_index:
KEY_SYM {}
......@@ -4633,7 +4638,6 @@ keyword:
| GLOBAL_SYM {}
| HANDLER_SYM {}
| HASH_SYM {}
| HEAP_SYM {}
| HELP_SYM {}
| HOSTS_SYM {}
| HOUR_SYM {}
......@@ -4641,7 +4645,6 @@ keyword:
| IMPORT {}
| INDEXES {}
| ISOLATION {}
| ISAM_SYM {}
| ISSUER_SYM {}
| INNOBASE_SYM {}
| INSERT_METHOD {}
......@@ -4672,8 +4675,6 @@ keyword:
| MAX_QUERIES_PER_HOUR {}
| MAX_UPDATES_PER_HOUR {}
| MEDIUM_SYM {}
| MERGE_SYM {}
| MEMORY_SYM {}
| MICROSECOND_SYM {}
| MINUTE_SYM {}
| MIN_ROWS {}
......@@ -4683,7 +4684,6 @@ keyword:
| MULTILINESTRING {}
| MULTIPOINT {}
| MULTIPOLYGON {}
| MYISAM_SYM {}
| NAMES_SYM {}
| NATIONAL_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