Commit 54108b2f authored by unknown's avatar unknown

Merge


BitKeeper/etc/ignore:
  auto-union
sql/sql_handler.cc:
  Auto merged
Docs/manual.texi:
  SCCS merged
parents 5478a2ad ad24c890
...@@ -287,6 +287,7 @@ libmysqld/sql_command ...@@ -287,6 +287,7 @@ libmysqld/sql_command
libmysqld/sql_crypt.cc libmysqld/sql_crypt.cc
libmysqld/sql_db.cc libmysqld/sql_db.cc
libmysqld/sql_delete.cc libmysqld/sql_delete.cc
libmysqld/sql_do.cc
libmysqld/sql_handler.cc libmysqld/sql_handler.cc
libmysqld/sql_insert.cc libmysqld/sql_insert.cc
libmysqld/sql_lex.cc libmysqld/sql_lex.cc
...@@ -367,6 +368,7 @@ scripts/mysql_config ...@@ -367,6 +368,7 @@ scripts/mysql_config
scripts/mysql_convert_table_format scripts/mysql_convert_table_format
scripts/mysql_explain_log scripts/mysql_explain_log
scripts/mysql_find_rows scripts/mysql_find_rows
scripts/mysql_fix_extensions
scripts/mysql_fix_privilege_tables scripts/mysql_fix_privilege_tables
scripts/mysql_install_db scripts/mysql_install_db
scripts/mysql_setpermission scripts/mysql_setpermission
...@@ -398,6 +400,7 @@ sql-bench/test-connect ...@@ -398,6 +400,7 @@ sql-bench/test-connect
sql-bench/test-create sql-bench/test-create
sql-bench/test-insert sql-bench/test-insert
sql-bench/test-select sql-bench/test-select
sql-bench/test-transactions
sql-bench/test-wisconsin sql-bench/test-wisconsin
sql/.gdbinit sql/.gdbinit
sql/gen_lex_hash sql/gen_lex_hash
...@@ -445,5 +448,3 @@ vio/test-ssl ...@@ -445,5 +448,3 @@ vio/test-ssl
vio/test-sslclient vio/test-sslclient
vio/test-sslserver vio/test-sslserver
vio/viotest-ssl vio/viotest-ssl
sql-bench/test-transactions
libmysqld/sql_do.cc
...@@ -8050,6 +8050,10 @@ version 4.0; ...@@ -8050,6 +8050,10 @@ version 4.0;
@itemize @bullet @itemize @bullet
@item @item
To use @code{MATCH ... AGAINST (... IN BOOLEAN MODE)} with your tables,
you need to rebuild them with @code{ALTER TABLE table_name TYPE=MyISAM},
@strong{even} if they are of @code{MyISAM} type.
@item
@code{LOCATE()} and @code{INSTR()} are case sensitive if neither @code{LOCATE()} and @code{INSTR()} are case sensitive if neither
argument is a binary string. argument is a binary string.
@item @item
...@@ -22090,8 +22094,12 @@ is @code{localhost}. ...@@ -22090,8 +22094,12 @@ is @code{localhost}.
Lock all tables before starting the dump. The tables are locked with Lock all tables before starting the dump. The tables are locked with
@code{READ LOCAL} to allow concurrent inserts in the case of @code{MyISAM} @code{READ LOCAL} to allow concurrent inserts in the case of @code{MyISAM}
tables. tables.
@item -K, --no-disable-keys.
@code{/*!40000 ALTER TABLE tb_name DISABLE KEYS */;} and
@code{/*!40000 ALTER TABLE tb_name ENABLE KEYS */;}
will not be put in the output.
@item -n, --no-create-db @item -n, --no-create-db
'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' will not be put in the @code{CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;} will not be put in the
output. The above line will be added otherwise, if --databases or output. The above line will be added otherwise, if --databases or
--all-databases option was given. --all-databases option was given.
@item -t, --no-create-info @item -t, --no-create-info
...@@ -22140,6 +22148,10 @@ Verbose mode. Print out more information on what the program does. ...@@ -22140,6 +22148,10 @@ Verbose mode. Print out more information on what the program does.
Print version information and exit. Print version information and exit.
@item -w, --where='where-condition' @item -w, --where='where-condition'
Dump only selected records. Note that quotes are mandatory: Dump only selected records. Note that quotes are mandatory:
@item -X, --xml
Dumps a database as well formed XML
@item -x, --first-slave
Locks all tables across all databases.
@example @example
"--where=user='jimf'" "-wuserid>1" "-wuserid<1" "--where=user='jimf'" "-wuserid>1" "-wuserid<1"
...@@ -34566,15 +34578,6 @@ options, MySQL simply renames the files that correspond to the table ...@@ -34566,15 +34578,6 @@ options, MySQL simply renames the files that correspond to the table
@code{tbl_name}. There is no need to create the temporary table. @code{tbl_name}. There is no need to create the temporary table.
@xref{RENAME TABLE,, @code{RENAME TABLE}}. @xref{RENAME TABLE,, @code{RENAME TABLE}}.
@item
Since @strong{MySQL 4.0} the above feature can be activated explicitly.
@code{ALTER TABLE ... DISABLE KEYS} makes MySQL to stop updating
non-unique indexes for @code{MyISAM} table.
@code{ALTER TABLE ... ENABLE KEYS} then should be used to recreate missing
indexes. As MySQL does it with special algorithm which is much
faster then inserting keys one by one, disabling keys could give a
considerable speedup on bulk inserts.
@item @item
@code{create_definition} clauses use the same syntax for @code{ADD} and @code{create_definition} clauses use the same syntax for @code{ADD} and
@code{CHANGE} as for @code{CREATE TABLE}. Note that this syntax includes @code{CHANGE} as for @code{CREATE TABLE}. Note that this syntax includes
...@@ -34674,6 +34677,15 @@ If you use @code{ALTER TABLE} on a @code{MyISAM} table, all non-unique ...@@ -34674,6 +34677,15 @@ If you use @code{ALTER TABLE} on a @code{MyISAM} table, all non-unique
indexes are created in a separate batch (like in @code{REPAIR}). indexes are created in a separate batch (like in @code{REPAIR}).
This should make @code{ALTER TABLE} much faster when you have many indexes. This should make @code{ALTER TABLE} much faster when you have many indexes.
@item
Since @strong{MySQL 4.0} the above feature can be activated explicitly.
@code{ALTER TABLE ... DISABLE KEYS} makes MySQL to stop updating
non-unique indexes for @code{MyISAM} table.
@code{ALTER TABLE ... ENABLE KEYS} then should be used to recreate missing
indexes. As MySQL does it with special algorithm which is much
faster then inserting keys one by one, disabling keys could give a
considerable speedup on bulk inserts.
@item @item
@findex mysql_info() @findex mysql_info()
With the C API function @code{mysql_info()}, you can find out how many With the C API function @code{mysql_info()}, you can find out how many
...@@ -47828,6 +47840,11 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. ...@@ -47828,6 +47840,11 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet @itemize @bullet
@item @item
@code{mysqldump} now puts @code{ALTER TABLE table_name DISABLE KEYS} and
@code{ALTER TABLE table_name DISABLE KEYS} in the sql dump.
@item
Added @code{mysql_fix_extensions} script
@item
Fixed stack overrun problem @code{LOAD DATA FROM MASTER} on OSF1. Fixed stack overrun problem @code{LOAD DATA FROM MASTER} on OSF1.
@item @item
Fixed shutdown problem on HPUX. Fixed shutdown problem on HPUX.
...@@ -72,8 +72,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0, ...@@ -72,8 +72,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0,
lock_tables=0,ignore_errors=0,flush_logs=0,replace=0, lock_tables=0,ignore_errors=0,flush_logs=0,replace=0,
ignore=0,opt_drop=0,opt_keywords=0,opt_lock=0,opt_compress=0, ignore=0,opt_drop=0,opt_keywords=0,opt_lock=0,opt_compress=0,
opt_delayed=0,create_options=0,opt_quoted=0,opt_databases=0, opt_delayed=0,create_options=0,opt_quoted=0,opt_databases=0,
opt_alldbs=0,opt_create_db=0,opt_first_slave=0, opt_alldbs=0,opt_create_db=0,opt_first_slave=0,
opt_autocommit=0, opt_master_data, opt_xml=0; opt_autocommit=0,opt_master_data,opt_disable_keys=0,opt_xml=0;
static MYSQL mysql_connection,*sock=0; static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0, *current_host=0,*path=0,*fields_terminated=0,
...@@ -90,55 +90,56 @@ FILE *md_result_file; ...@@ -90,55 +90,56 @@ FILE *md_result_file;
static struct option long_options[] = static struct option long_options[] =
{ {
{"all-databases", no_argument, 0, 'A'}, {"all-databases", no_argument, 0, 'A'},
{"all", no_argument, 0, 'a'}, {"all", no_argument, 0, 'a'},
{"add-drop-table", no_argument, 0, OPT_DROP}, {"add-drop-table", no_argument, 0, OPT_DROP},
{"add-locks", no_argument, 0, OPT_LOCKS}, {"add-locks", no_argument, 0, OPT_LOCKS},
{"allow-keywords", no_argument, 0, OPT_KEYWORDS}, {"allow-keywords", no_argument, 0, OPT_KEYWORDS},
{"character-sets-dir",required_argument,0, OPT_CHARSETS_DIR}, {"character-sets-dir",required_argument,0, OPT_CHARSETS_DIR},
{"complete-insert", no_argument, 0, 'c'}, {"complete-insert", no_argument, 0, 'c'},
{"compress", no_argument, 0, 'C'}, {"compress", no_argument, 0, 'C'},
{"databases", no_argument, 0, 'B'}, {"databases", no_argument, 0, 'B'},
{"debug", optional_argument, 0, '#'}, {"debug", optional_argument, 0, '#'},
{"default-character-set", required_argument, 0, OPT_DEFAULT_CHARSET}, {"default-character-set", required_argument, 0, OPT_DEFAULT_CHARSET},
{"delayed-insert", no_argument, 0, OPT_DELAYED}, {"delayed-insert", no_argument, 0, OPT_DELAYED},
{"extended-insert", no_argument, 0, 'e'}, {"extended-insert", no_argument, 0, 'e'},
{"fields-terminated-by", required_argument, 0, (int) OPT_FTB}, {"fields-terminated-by", required_argument, 0, (int) OPT_FTB},
{"fields-enclosed-by", required_argument, 0, (int) OPT_ENC}, {"fields-enclosed-by", required_argument, 0, (int) OPT_ENC},
{"fields-optionally-enclosed-by", required_argument, 0, (int) OPT_O_ENC}, {"fields-optionally-enclosed-by", required_argument, 0, (int) OPT_O_ENC},
{"fields-escaped-by", required_argument, 0, (int) OPT_ESC}, {"fields-escaped-by", required_argument, 0, (int) OPT_ESC},
{"first-slave", no_argument, 0, 'x'}, {"first-slave", no_argument, 0, 'x'},
{"flush-logs", no_argument, 0, 'F'}, {"flush-logs", no_argument, 0, 'F'},
{"force", no_argument, 0, 'f'}, {"force", no_argument, 0, 'f'},
{"help", no_argument, 0, '?'}, {"help", no_argument, 0, '?'},
{"host", required_argument, 0, 'h'}, {"host", required_argument, 0, 'h'},
{"lines-terminated-by", required_argument, 0, (int) OPT_LTB}, {"lines-terminated-by", required_argument, 0, (int) OPT_LTB},
{"lock-tables", no_argument, 0, 'l'}, {"lock-tables", no_argument, 0, 'l'},
{"master-data", no_argument, 0, OPT_MASTER_DATA}, {"master-data", no_argument, 0, OPT_MASTER_DATA},
{"no-autocommit", no_argument, 0, OPT_AUTOCOMMIT}, {"no-autocommit", no_argument, 0, OPT_AUTOCOMMIT},
{"no-create-db", no_argument, 0, 'n'}, {"no-create-db", no_argument, 0, 'n'},
{"no-create-info", no_argument, 0, 't'}, {"no-create-info", no_argument, 0, 't'},
{"no-data", no_argument, 0, 'd'}, {"no-data", no_argument, 0, 'd'},
{"opt", no_argument, 0, OPT_OPTIMIZE}, {"no-disable-keys", no_argument, 0, 'K'},
{"password", optional_argument, 0, 'p'}, {"opt", no_argument, 0, OPT_OPTIMIZE},
{"password", optional_argument, 0, 'p'},
#ifdef __WIN__ #ifdef __WIN__
{"pipe", no_argument, 0, 'W'}, {"pipe", no_argument, 0, 'W'},
#endif #endif
{"port", required_argument, 0, 'P'}, {"port", required_argument, 0, 'P'},
{"quick", no_argument, 0, 'q'}, {"quick", no_argument, 0, 'q'},
{"quote-names", no_argument, 0, 'Q'}, {"quote-names", no_argument, 0, 'Q'},
{"result-file", required_argument, 0, 'r'}, {"result-file", required_argument, 0, 'r'},
{"set-variable", required_argument, 0, 'O'}, {"set-variable", required_argument, 0, 'O'},
{"socket", required_argument, 0, 'S'}, {"socket", required_argument, 0, 'S'},
#include "sslopt-longopts.h" #include "sslopt-longopts.h"
{"tab", required_argument, 0, 'T'}, {"tab", required_argument, 0, 'T'},
{"tables", no_argument, 0, OPT_TABLES}, {"tables", no_argument, 0, OPT_TABLES},
#ifndef DONT_ALLOW_USER_CHANGE #ifndef DONT_ALLOW_USER_CHANGE
{"user", required_argument, 0, 'u'}, {"user", required_argument, 0, 'u'},
#endif #endif
{"verbose", no_argument, 0, 'v'}, {"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, 0, 'V'},
{"where", required_argument, 0, 'w'}, {"where", required_argument, 0, 'w'},
{"xml", no_argument, 0, 'X'}, {"xml", no_argument, 0, 'X'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
...@@ -214,6 +215,9 @@ static void usage(void) ...@@ -214,6 +215,9 @@ static void usage(void)
puts("\ puts("\
-l, --lock-tables Lock all tables for read.\n\ -l, --lock-tables Lock all tables for read.\n\
--no-autocommit Wrap tables with autocommit/commit statements.\n\ --no-autocommit Wrap tables with autocommit/commit statements.\n\
-K, --no-disable-keys '/*!40000 ALTER TABLE tb_name DISABLE KEYS */;\n\
and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */;\n\
will not be put in the output.\n\
-n, --no-create-db 'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;'\n\ -n, --no-create-db 'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;'\n\
will not be put in the output. The above line will\n\ will not be put in the output. The above line will\n\
be added otherwise, if --databases or\n\ be added otherwise, if --databases or\n\
...@@ -227,7 +231,7 @@ puts("\ ...@@ -227,7 +231,7 @@ puts("\
-p, --password[=...] Password to use when connecting to server.\n\ -p, --password[=...] Password to use when connecting to server.\n\
If password is not given it's solicited on the tty.\n"); If password is not given it's solicited on the tty.\n");
#ifdef __WIN__ #ifdef __WIN__
puts("-W, --pipe Use named pipes to connect to server"); puts("-W, --pipe Use named pipes to connect to server");
#endif #endif
printf("\ printf("\
-P, --port=... Port number to use for connection.\n\ -P, --port=... Port number to use for connection.\n\
...@@ -305,7 +309,7 @@ static int get_options(int *argc,char ***argv) ...@@ -305,7 +309,7 @@ static int get_options(int *argc,char ***argv)
load_defaults("my",load_default_groups,argc,argv); load_defaults("my",load_default_groups,argc,argv);
set_all_changeable_vars(md_changeable_vars); set_all_changeable_vars(md_changeable_vars);
while ((c=getopt_long(*argc,*argv, while ((c=getopt_long(*argc,*argv,
"#::p::h:u:O:P:r:S:T:EBaAcCdefFlnqtvVw:?IxX", "#::p::h:u:O:P:r:S:T:EBaAcCdefFKlnqtvVw:?IxX",
long_options, &option_index)) != EOF) long_options, &option_index)) != EOF)
{ {
switch(c) { switch(c) {
...@@ -341,6 +345,9 @@ static int get_options(int *argc,char ***argv) ...@@ -341,6 +345,9 @@ static int get_options(int *argc,char ***argv)
my_free(current_host,MYF(MY_ALLOW_ZERO_PTR)); my_free(current_host,MYF(MY_ALLOW_ZERO_PTR));
current_host=my_strdup(optarg,MYF(MY_WME)); current_host=my_strdup(optarg,MYF(MY_WME));
break; break;
case 'K':
opt_disable_keys=1;
break;
case 'n': case 'n':
opt_create_db = 1; opt_create_db = 1;
break; break;
...@@ -408,7 +415,7 @@ static int get_options(int *argc,char ***argv) ...@@ -408,7 +415,7 @@ static int get_options(int *argc,char ***argv)
case 'w': case 'w':
where=optarg; where=optarg;
break; break;
case 'X': opt_xml = 1; break; case 'X': opt_xml = 1; opt_disable_keys=1; break;
case 'x': case 'x':
opt_first_slave=1; opt_first_slave=1;
break; break;
...@@ -618,9 +625,9 @@ static uint getTableStructure(char *table, char* db) ...@@ -618,9 +625,9 @@ static uint getTableStructure(char *table, char* db)
MYSQL_ROW row; MYSQL_ROW row;
my_bool init=0; my_bool init=0;
uint numFields; uint numFields;
char *strpos, *table_name; char *strpos, *table_name;
const char *delayed; const char *delayed;
char name_buff[NAME_LEN+3],table_buff[NAME_LEN+3]; char name_buff[NAME_LEN+3],table_buff[NAME_LEN+3];
FILE *sql_file = md_result_file; FILE *sql_file = md_result_file;
DBUG_ENTER("getTableStructure"); DBUG_ENTER("getTableStructure");
...@@ -643,7 +650,7 @@ static uint getTableStructure(char *table, char* db) ...@@ -643,7 +650,7 @@ static uint getTableStructure(char *table, char* db)
if (mysql_query(sock, buff)) if (mysql_query(sock, buff))
{ {
fprintf(stderr, "%s: Can't get CREATE TABLE for table '%s' (%s)\n", fprintf(stderr, "%s: Can't get CREATE TABLE for table '%s' (%s)\n",
my_progname, table, mysql_error(sock)); my_progname, table, mysql_error(sock));
safe_exit(EX_MYSQLERR); safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -653,7 +660,7 @@ static uint getTableStructure(char *table, char* db) ...@@ -653,7 +660,7 @@ static uint getTableStructure(char *table, char* db)
char filename[FN_REFLEN], tmp_path[FN_REFLEN]; char filename[FN_REFLEN], tmp_path[FN_REFLEN];
convert_dirname(tmp_path,path,NullS); convert_dirname(tmp_path,path,NullS);
sql_file= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4), sql_file= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
O_WRONLY, MYF(MY_WME)); O_WRONLY, MYF(MY_WME));
if (!sql_file) /* If file couldn't be opened */ if (!sql_file) /* If file couldn't be opened */
{ {
safe_exit(EX_MYSQLERR); safe_exit(EX_MYSQLERR);
...@@ -677,7 +684,7 @@ static uint getTableStructure(char *table, char* db) ...@@ -677,7 +684,7 @@ static uint getTableStructure(char *table, char* db)
if (mysql_query(sock,insert_pat) || !(tableRes=mysql_store_result(sock))) if (mysql_query(sock,insert_pat) || !(tableRes=mysql_store_result(sock)))
{ {
fprintf(stderr, "%s: Can't get info about table: '%s'\nerror: %s\n", fprintf(stderr, "%s: Can't get info about table: '%s'\nerror: %s\n",
my_progname, table, mysql_error(sock)); my_progname, table, mysql_error(sock));
safe_exit(EX_MYSQLERR); safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -883,6 +890,8 @@ static uint getTableStructure(char *table, char* db) ...@@ -883,6 +890,8 @@ static uint getTableStructure(char *table, char* db)
fputs(";\n", sql_file); fputs(";\n", sql_file);
} }
} }
if (!opt_disable_keys)
fprintf(sql_file,"\n/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",table_name);
if (cFlag) if (cFlag)
{ {
strpos=strmov(strpos,") VALUES "); strpos=strmov(strpos,") VALUES ");
...@@ -982,7 +991,7 @@ static void dumpTable(uint numFields, char *table) ...@@ -982,7 +991,7 @@ static void dumpTable(uint numFields, char *table)
end= add_load_option(end, lines_terminated, " LINES TERMINATED BY"); end= add_load_option(end, lines_terminated, " LINES TERMINATED BY");
*end= '\0'; *end= '\0';
sprintf(buff," FROM %s",table); sprintf(buff," FROM %s",quote_name(table,table_buff));
end= strmov(end,buff); end= strmov(end,buff);
if (where) if (where)
end= strxmov(end, " WHERE ",where,NullS); end= strxmov(end, " WHERE ",where,NullS);
...@@ -1113,7 +1122,7 @@ static void dumpTable(uint numFields, char *table) ...@@ -1113,7 +1122,7 @@ static void dumpTable(uint numFields, char *table)
if (row[i]) if (row[i])
{ {
if (!IS_NUM_FIELD(field)) if (!IS_NUM_FIELD(field))
{ {
if (opt_xml) if (opt_xml)
print_quoted_xml(md_result_file, field->name, row[i], print_quoted_xml(md_result_file, field->name, row[i],
lengths[i]); lengths[i]);
...@@ -1173,7 +1182,7 @@ static void dumpTable(uint numFields, char *table) ...@@ -1173,7 +1182,7 @@ static void dumpTable(uint numFields, char *table)
//XML - close table tag and supress regular output //XML - close table tag and supress regular output
if (opt_xml) if (opt_xml)
fprintf(md_result_file, "\t</%s>\n", table); fprintf(md_result_file, "\t</%s>\n", table);
else if (extended_insert && row_break) else if (extended_insert && row_break)
fputs(";\n", md_result_file); /* If not empty table */ fputs(";\n", md_result_file); /* If not empty table */
fflush(md_result_file); fflush(md_result_file);
...@@ -1189,6 +1198,9 @@ static void dumpTable(uint numFields, char *table) ...@@ -1189,6 +1198,9 @@ static void dumpTable(uint numFields, char *table)
safe_exit(EX_CONSCHECK); safe_exit(EX_CONSCHECK);
return; return;
} }
if (!opt_disable_keys)
fprintf(md_result_file,"\n/*!40000 ALTER TABLE %s ENABLE KEYS */;\n",
quote_name(table,table_buff));
if (opt_lock) if (opt_lock)
fputs("UNLOCK TABLES;\n", md_result_file); fputs("UNLOCK TABLES;\n", md_result_file);
if (opt_autocommit) if (opt_autocommit)
...@@ -1270,7 +1282,7 @@ static int dump_databases(char **db_names) ...@@ -1270,7 +1282,7 @@ static int dump_databases(char **db_names)
{ {
int result=0; int result=0;
for ( ; *db_names ; db_names++) for ( ; *db_names ; db_names++)
{ {
//XML edit - add database element //XML edit - add database element
if (opt_xml) if (opt_xml)
fprintf(md_result_file, "<%s>\n", *db_names); fprintf(md_result_file, "<%s>\n", *db_names);
...@@ -1466,8 +1478,8 @@ int main(int argc, char **argv) ...@@ -1466,8 +1478,8 @@ int main(int argc, char **argv)
{ {
my_printf_error(0, "Error: Couldn't execute 'SHOW MASTER STATUS': %s", my_printf_error(0, "Error: Couldn't execute 'SHOW MASTER STATUS': %s",
MYF(0), mysql_error(sock)); MYF(0), mysql_error(sock));
} }
else else
{ {
row = mysql_fetch_row(master); row = mysql_fetch_row(master);
if(row[0] && row[1]) { if(row[0] && row[1]) {
......
...@@ -20,6 +20,7 @@ bin_SCRIPTS = @server_scripts@ \ ...@@ -20,6 +20,7 @@ bin_SCRIPTS = @server_scripts@ \
msql2mysql \ msql2mysql \
mysql_config \ mysql_config \
mysql_fix_privilege_tables \ mysql_fix_privilege_tables \
mysql_fix_extensions \
mysql_setpermission \ mysql_setpermission \
mysql_zap \ mysql_zap \
mysqlaccess \ mysqlaccess \
...@@ -35,6 +36,7 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \ ...@@ -35,6 +36,7 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \
msql2mysql.sh \ msql2mysql.sh \
mysql_config.sh \ mysql_config.sh \
mysql_fix_privilege_tables.sh \ mysql_fix_privilege_tables.sh \
mysql_fix_extensions.sh \
mysql_install_db.sh \ mysql_install_db.sh \
mysql_setpermission.sh \ mysql_setpermission.sh \
mysql_zap.sh \ mysql_zap.sh \
...@@ -61,6 +63,7 @@ CLEANFILES = @server_scripts@ \ ...@@ -61,6 +63,7 @@ CLEANFILES = @server_scripts@ \
msql2mysql \ msql2mysql \
mysql_config \ mysql_config \
mysql_fix_privilege_tables \ mysql_fix_privilege_tables \
mysql_fix_extensions \
mysql_setpermission \ mysql_setpermission \
mysql_zap \ mysql_zap \
mysqlaccess \ mysqlaccess \
......
#!@PERL@
# This is a utility for MySQL. It is not needed by any standard part
# of MySQL.
# Usage: mysql_fix_extentions datadir
# does not work with RAID, with InnoDB or BDB tables
# makes .frm lowercase and .MYI/MYD/ISM/ISD uppercase
# useful when datafiles are copied from windows
die "Usage: $0 datadir\n" unless -d $ARGV[0];
for $a (<$ARGV[0]/*/*.*>) { $_=$a;
s/\.frm$/.frm/i;
s/\.(is[md]|my[id])$/\U$&/;
rename ($a, $_) || warn "Cannot rename $a => $_ : $!";
}
...@@ -90,7 +90,7 @@ class ha_berkeley: public handler ...@@ -90,7 +90,7 @@ class ha_berkeley: public handler
HA_REC_NOT_IN_SEQ | HA_REC_NOT_IN_SEQ |
HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_LASTKEY_ORDER | HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_LASTKEY_ORDER |
HA_LONGLONG_KEYS | HA_NULL_KEY | HA_HAVE_KEY_READ_ONLY | HA_LONGLONG_KEYS | HA_NULL_KEY | HA_HAVE_KEY_READ_ONLY |
HA_BLOB_KEY | HA_NOT_EXACT_COUNT | HA_NO_FULLTEXT_KEY | HA_BLOB_KEY | HA_NOT_EXACT_COUNT |
HA_PRIMARY_KEY_IN_READ_INDEX | HA_DROP_BEFORE_CREATE | HA_PRIMARY_KEY_IN_READ_INDEX | HA_DROP_BEFORE_CREATE |
HA_AUTO_PART_KEY), HA_AUTO_PART_KEY),
changed_rows(0),last_dup_key((uint) -1),version(0),using_ignore(0) changed_rows(0),last_dup_key((uint) -1),version(0),using_ignore(0)
......
...@@ -35,7 +35,7 @@ class ha_heap: public handler ...@@ -35,7 +35,7 @@ class ha_heap: public handler
ulong option_flag() const ulong option_flag() const
{ return (HA_READ_RND_SAME | HA_NO_INDEX | HA_ONLY_WHOLE_INDEX | { return (HA_READ_RND_SAME | HA_NO_INDEX | HA_ONLY_WHOLE_INDEX |
HA_WRONG_ASCII_ORDER | HA_KEYPOS_TO_RNDPOS | HA_NO_BLOBS | HA_WRONG_ASCII_ORDER | HA_KEYPOS_TO_RNDPOS | HA_NO_BLOBS |
HA_REC_NOT_IN_SEQ | HA_NO_FULLTEXT_KEY); } HA_REC_NOT_IN_SEQ); }
uint max_record_length() const { return HA_MAX_REC_LENGTH; } uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return MAX_KEY; } uint max_keys() const { return MAX_KEY; }
uint max_key_parts() const { return MAX_REF_PARTS; } uint max_key_parts() const { return MAX_REF_PARTS; }
......
...@@ -79,7 +79,7 @@ class ha_innobase: public handler ...@@ -79,7 +79,7 @@ class ha_innobase: public handler
HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER | HA_KEYPOS_TO_RNDPOS | HA_LASTKEY_ORDER |
HA_HAVE_KEY_READ_ONLY | HA_READ_NOT_EXACT_KEY | HA_HAVE_KEY_READ_ONLY | HA_READ_NOT_EXACT_KEY |
HA_LONGLONG_KEYS | HA_NULL_KEY | HA_LONGLONG_KEYS | HA_NULL_KEY |
HA_NOT_EXACT_COUNT | HA_NO_FULLTEXT_KEY | HA_NOT_EXACT_COUNT |
HA_NO_WRITE_DELAYED | HA_NO_WRITE_DELAYED |
HA_PRIMARY_KEY_IN_READ_INDEX | HA_PRIMARY_KEY_IN_READ_INDEX |
HA_DROP_BEFORE_CREATE | HA_DROP_BEFORE_CREATE |
......
...@@ -34,7 +34,7 @@ class ha_isam: public handler ...@@ -34,7 +34,7 @@ class ha_isam: public handler
HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_LASTKEY_ORDER | HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_LASTKEY_ORDER |
HA_HAVE_KEY_READ_ONLY | HA_READ_NOT_EXACT_KEY | HA_HAVE_KEY_READ_ONLY | HA_READ_NOT_EXACT_KEY |
HA_LONGLONG_KEYS | HA_KEY_READ_WRONG_STR | HA_DUPP_POS | HA_LONGLONG_KEYS | HA_KEY_READ_WRONG_STR | HA_DUPP_POS |
HA_NOT_DELETE_WITH_CACHE | HA_NO_FULLTEXT_KEY) HA_NOT_DELETE_WITH_CACHE)
{} {}
~ha_isam() {} ~ha_isam() {}
const char *table_type() const { return "ISAM"; } const char *table_type() const { return "ISAM"; }
......
...@@ -33,7 +33,7 @@ class ha_isammrg: public handler ...@@ -33,7 +33,7 @@ class ha_isammrg: public handler
const char *table_type() const { return "MRG_ISAM"; } const char *table_type() const { return "MRG_ISAM"; }
const char **bas_ext() const; const char **bas_ext() const;
ulong option_flag() const { return HA_READ_RND_SAME | HA_KEYPOS_TO_RNDPOS ulong option_flag() const { return HA_READ_RND_SAME | HA_KEYPOS_TO_RNDPOS
| HA_REC_NOT_IN_SEQ | HA_NO_FULLTEXT_KEY;} | HA_REC_NOT_IN_SEQ;}
uint max_record_length() const { return HA_MAX_REC_LENGTH; } uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return 0; } uint max_keys() const { return 0; }
uint max_key_parts() const { return 0; } uint max_key_parts() const { return 0; }
......
...@@ -45,9 +45,10 @@ class ha_myisam: public handler ...@@ -45,9 +45,10 @@ class ha_myisam: public handler
public: public:
ha_myisam(TABLE *table): handler(table), file(0), ha_myisam(TABLE *table): handler(table), file(0),
int_option_flag(HA_READ_NEXT | HA_READ_PREV | HA_READ_RND_SAME | int_option_flag(HA_READ_NEXT | HA_READ_PREV | HA_READ_RND_SAME |
HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_LASTKEY_ORDER | HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_LASTKEY_ORDER |
HA_HAVE_KEY_READ_ONLY | HA_READ_NOT_EXACT_KEY | HA_HAVE_KEY_READ_ONLY | HA_READ_NOT_EXACT_KEY |
HA_LONGLONG_KEYS | HA_NULL_KEY | HA_LONGLONG_KEYS | HA_NULL_KEY |
HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
HA_DUPP_POS | HA_BLOB_KEY | HA_AUTO_PART_KEY), HA_DUPP_POS | HA_BLOB_KEY | HA_AUTO_PART_KEY),
enable_activate_all_index(1) enable_activate_all_index(1)
{} {}
......
...@@ -35,7 +35,7 @@ class ha_myisammrg: public handler ...@@ -35,7 +35,7 @@ class ha_myisammrg: public handler
ulong option_flag() const ulong option_flag() const
{ return (HA_REC_NOT_IN_SEQ | HA_READ_NEXT | { return (HA_REC_NOT_IN_SEQ | HA_READ_NEXT |
HA_READ_PREV | HA_READ_RND_SAME | HA_READ_PREV | HA_READ_RND_SAME |
HA_HAVE_KEY_READ_ONLY | HA_NO_FULLTEXT_KEY | HA_HAVE_KEY_READ_ONLY |
HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER |
HA_LASTKEY_ORDER | HA_READ_NOT_EXACT_KEY | HA_LASTKEY_ORDER | HA_READ_NOT_EXACT_KEY |
HA_LONGLONG_KEYS | HA_NULL_KEY | HA_BLOB_KEY); } HA_LONGLONG_KEYS | HA_NULL_KEY | HA_BLOB_KEY); }
......
...@@ -76,7 +76,8 @@ ...@@ -76,7 +76,8 @@
#define HA_NOT_DELETE_WITH_CACHE (HA_NOT_READ_AFTER_KEY*2) #define HA_NOT_DELETE_WITH_CACHE (HA_NOT_READ_AFTER_KEY*2)
#define HA_NO_TEMP_TABLES (HA_NOT_DELETE_WITH_CACHE*2) #define HA_NO_TEMP_TABLES (HA_NOT_DELETE_WITH_CACHE*2)
#define HA_NO_PREFIX_CHAR_KEYS (HA_NO_TEMP_TABLES*2) #define HA_NO_PREFIX_CHAR_KEYS (HA_NO_TEMP_TABLES*2)
#define HA_NO_FULLTEXT_KEY (HA_NO_PREFIX_CHAR_KEYS*2) #define HA_CAN_FULLTEXT (HA_NO_PREFIX_CHAR_KEYS*2)
#define HA_CAN_SQL_HANDLER (HA_CAN_FULLTEXT*2)
/* Parameters for open() (in register form->filestat) */ /* Parameters for open() (in register form->filestat) */
/* HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED */ /* HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED */
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
thd->open_tables=thd->handler_tables; \ thd->open_tables=thd->handler_tables; \
thd->handler_tables=tmp; } thd->handler_tables=tmp; }
static TABLE **find_table_ptr_by_name(THD *thd, const char *db, static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
const char *table_name); const char *table_name);
int mysql_ha_open(THD *thd, TABLE_LIST *tables) int mysql_ha_open(THD *thd, TABLE_LIST *tables)
...@@ -54,6 +54,13 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables) ...@@ -54,6 +54,13 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables)
if (err) if (err)
return -1; return -1;
// there can be only one table in *tables
if (!(tables->table->file->option_flag() & HA_CAN_SQL_HANDLER))
{
my_printf_error(ER_ILLEGAL_HA,ER(ER_ILLEGAL_HA),MYF(0), tables->name);
return -1;
}
send_ok(&thd->net); send_ok(&thd->net);
return 0; return 0;
} }
...@@ -73,7 +80,7 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables) ...@@ -73,7 +80,7 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables)
return 0; return 0;
} }
static enum enum_ha_read_modes rkey_to_rnext[]= static enum enum_ha_read_modes rkey_to_rnext[]=
{ RNEXT, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV }; { RNEXT, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV };
int mysql_ha_read(THD *thd, TABLE_LIST *tables, int mysql_ha_read(THD *thd, TABLE_LIST *tables,
...@@ -166,7 +173,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, ...@@ -166,7 +173,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
if (!(key= (byte*) sql_calloc(ALIGN_SIZE(key_len)))) if (!(key= (byte*) sql_calloc(ALIGN_SIZE(key_len))))
{ {
send_error(&thd->net,ER_OUTOFMEMORY); send_error(&thd->net,ER_OUTOFMEMORY);
goto err; goto err;
} }
key_copy(key, table, keyno, key_len); key_copy(key, table, keyno, key_len);
err=table->file->index_read(table->record[0], err=table->file->index_read(table->record[0],
...@@ -176,7 +183,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, ...@@ -176,7 +183,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
} }
default: default:
send_error(&thd->net,ER_ILLEGAL_HA); send_error(&thd->net,ER_ILLEGAL_HA);
goto err; goto err;
} }
if (err) if (err)
...@@ -191,7 +198,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, ...@@ -191,7 +198,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
goto ok; goto ok;
} }
if (cond) if (cond)
{ {
err=err; err=err;
if(!cond->val_int()) if(!cond->val_int())
continue; continue;
...@@ -234,7 +241,7 @@ err: ...@@ -234,7 +241,7 @@ err:
**************************************************************************/ **************************************************************************/
/* Note: this function differs from find_locked_table() because we're looking /* Note: this function differs from find_locked_table() because we're looking
here for alias, not real table name here for alias, not real table name
*/ */
static TABLE **find_table_ptr_by_name(THD *thd, const char *db, static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
const char *table_name) const char *table_name)
...@@ -244,7 +251,7 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db, ...@@ -244,7 +251,7 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
if (!db || ! *db) if (!db || ! *db)
db= thd->db ? thd->db : ""; db= thd->db ? thd->db : "";
dblen=strlen(db)+1; dblen=strlen(db)+1;
ptr=&(thd->handler_tables); ptr=&(thd->handler_tables);
for (TABLE *table=*ptr; table ; table=*ptr) for (TABLE *table=*ptr; table ; table=*ptr)
......
...@@ -430,7 +430,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, ...@@ -430,7 +430,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if (key->type == Key::FULLTEXT) if (key->type == Key::FULLTEXT)
{ {
if (file->option_flag() & HA_NO_FULLTEXT_KEY) if (!(file->option_flag() & HA_CAN_FULLTEXT))
{ {
my_error(ER_TABLE_CANT_HANDLE_FULLTEXT, MYF(0)); my_error(ER_TABLE_CANT_HANDLE_FULLTEXT, MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
......
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