Commit aa358092 authored by monty@donna.mysql.com's avatar monty@donna.mysql.com

RENAME TABLE table_name TO new_table_name ; Faster Alloc

Small bug fixes
parent 86f4dbe2
...@@ -275,7 +275,7 @@ Is there anything special to do when upgrading/downgrading MySQL? ...@@ -275,7 +275,7 @@ Is there anything special to do when upgrading/downgrading MySQL?
How standards-compatible is MySQL? How standards-compatible is MySQL?
* Extensions to ANSI:: @strong{MySQL} extensions to ANSI SQL92 * Extensions to ANSI:: @strong{MySQL} extensions to ANSI SQL92
* Ansi mode:: Running @strong{MySQL} in ANSI mode * Ansi mode:: Runnning @strong{MySQL} in ANSI mode
* Differences from ANSI:: @strong{MySQL} differences compared to ANSI SQL92 * Differences from ANSI:: @strong{MySQL} differences compared to ANSI SQL92
* Missing functions:: Functionality missing from @strong{MySQL} * Missing functions:: Functionality missing from @strong{MySQL}
* Standards:: What standards does @strong{MySQL} follow? * Standards:: What standards does @strong{MySQL} follow?
...@@ -323,6 +323,7 @@ MySQL language reference ...@@ -323,6 +323,7 @@ MySQL language reference
* DROP DATABASE:: @code{DROP DATABASE} syntax * DROP DATABASE:: @code{DROP DATABASE} syntax
* CREATE TABLE:: @code{CREATE TABLE} syntax * CREATE TABLE:: @code{CREATE TABLE} syntax
* ALTER TABLE:: @code{ALTER TABLE} syntax * ALTER TABLE:: @code{ALTER TABLE} syntax
* RENAME TABLE::
* DROP TABLE:: @code{DROP TABLE} syntax * DROP TABLE:: @code{DROP TABLE} syntax
* OPTIMIZE TABLE:: @code{OPTIMIZE TABLE} syntax * OPTIMIZE TABLE:: @code{OPTIMIZE TABLE} syntax
* CHECK TABLE:: @code{CHECK TABLE} syntax * CHECK TABLE:: @code{CHECK TABLE} syntax
...@@ -608,7 +609,7 @@ Using @code{MySQL} with some common programs ...@@ -608,7 +609,7 @@ Using @code{MySQL} with some common programs
Problems and common errors Problems and common errors
* What is crashing:: How to determine what is causing problems * What is crashing:: How to determinate what is causing problems
* Crashing:: What to do if @strong{MySQL} keeps crashing * Crashing:: What to do if @strong{MySQL} keeps crashing
* Link errors:: Problems when linking with the @strong{MySQL} client library * Link errors:: Problems when linking with the @strong{MySQL} client library
* Common errors:: Some common errors when using @strong{MySQL} * Common errors:: Some common errors when using @strong{MySQL}
...@@ -647,7 +648,7 @@ Some common errors when using MySQL ...@@ -647,7 +648,7 @@ Some common errors when using MySQL
Solving some common problems with MySQL Solving some common problems with MySQL
* Log Replication:: Database replication with update log * Log Replication:: Database replication with update log
* Backup:: Database backups * Backup:: Database backups
* Update log:: The update log * Update log:: The update log
* Multiple servers:: Running multiple @strong{MySQL} servers on the same machine * Multiple servers:: Running multiple @strong{MySQL} servers on the same machine
...@@ -720,7 +721,7 @@ C API function descriptions ...@@ -720,7 +721,7 @@ C API function descriptions
* mysql_store_result:: @code{mysql_store_result()} * mysql_store_result:: @code{mysql_store_result()}
* mysql_thread_id:: @code{mysql_thread_id()} * mysql_thread_id:: @code{mysql_thread_id()}
* mysql_use_result:: @code{mysql_use_result()} * mysql_use_result:: @code{mysql_use_result()}
* NULL mysql_store_result:: Why is it that after @code{mysql_query()} returns success, @code{mysql_store_result()} sometimes returns @code{NULL}? * NULL mysql_store_result:: Why is it that after @code{mysql_query()} returns success, @code{mysql_store_result()} sometimes returns @code{NULL?}
* Query results:: What results can I get from a query? * Query results:: What results can I get from a query?
* Getting unique ID:: How can I get the unique ID for the last inserted row? * Getting unique ID:: How can I get the unique ID for the last inserted row?
* C API linking problems:: Problems linking with the C API * C API linking problems:: Problems linking with the C API
...@@ -1826,7 +1827,7 @@ Apart from the following links, you can find and download a lot of ...@@ -1826,7 +1827,7 @@ Apart from the following links, you can find and download a lot of
@strong{MySQL} programs, tools and APIs from the @strong{MySQL} programs, tools and APIs from the
@uref{http://www.mysql.com/Contrib/, Contrib directory}. @uref{http://www.mysql.com/Contrib/, Contrib directory}.
@subheading Tutorials and manuals @subheading Tutorials and Manuals
@itemize @bullet @itemize @bullet
@c just forwards to the devshed link below.. (jcole) @c just forwards to the devshed link below.. (jcole)
...@@ -2026,6 +2027,11 @@ reviewing. ...@@ -2026,6 +2027,11 @@ reviewing.
@item @item
@uref{http://www.omnis-software.com/products/studio/studio.html, OMNIS} @uref{http://www.omnis-software.com/products/studio/studio.html, OMNIS}
OMNIS Studio is a rapid application development (RAD) tool. OMNIS Studio is a rapid application development (RAD) tool.
@item
@uref{http://www.webplus.com, talentsoft Web+ 4.6}
Web+ is a powerful and comprehensive development language for use in
creating web-based client/server applications without writing complicated,
low-level and time-consuming CGI programs.
@end itemize @end itemize
@subheading Database design tools with MySQL support @subheading Database design tools with MySQL support
...@@ -8959,6 +8965,7 @@ comparisons to be done according to the ASCII order used on the ...@@ -8959,6 +8965,7 @@ comparisons to be done according to the ASCII order used on the
@strong{MySQL} maps each database to a directory under the @strong{MySQL} @strong{MySQL} maps each database to a directory under the @strong{MySQL}
data directory, and tables within a database to filenames in the database data directory, and tables within a database to filenames in the database
directory. directory.
This has two implications: This has two implications:
@itemize @minus @itemize @minus
...@@ -9015,11 +9022,12 @@ Use of @code{TEMPORARY} or @code{IF NOT EXISTS} with @code{CREATE TABLE}. ...@@ -9015,11 +9022,12 @@ Use of @code{TEMPORARY} or @code{IF NOT EXISTS} with @code{CREATE TABLE}.
Use of @code{COUNT(DISTINCT list)} where 'list' is more than one element. Use of @code{COUNT(DISTINCT list)} where 'list' is more than one element.
@item @item
Use of @code{CHANGE col_name}, @code{DROP col_name} or @code{DROP INDEX} Use of @code{CHANGE col_name}, @code{DROP col_name} or @code{DROP
in an @code{ALTER TABLE} statement. @xref{ALTER TABLE, , @code{ALTER TABLE}}. INDEX}, @code{IGNORE} or @code{RENAME} in an @code{ALTER TABLE}
statement. @xref{ALTER TABLE, , @code{ALTER TABLE}}.
@item @item
Use of @code{IGNORE} in an @code{ALTER TABLE} statement. Use of @code{RENAME TABLE}. @xref{RENAME TABLE, , @code{RENAME TABLE}}.
@item @item
Use of multiple @code{ADD}, @code{ALTER}, @code{DROP} or @code{CHANGE} Use of multiple @code{ADD}, @code{ALTER}, @code{DROP} or @code{CHANGE}
...@@ -11636,6 +11644,7 @@ to restart @code{mysqld} with @code{--skip-grant-tables} to be able to run ...@@ -11636,6 +11644,7 @@ to restart @code{mysqld} with @code{--skip-grant-tables} to be able to run
* DROP DATABASE:: @code{DROP DATABASE} syntax * DROP DATABASE:: @code{DROP DATABASE} syntax
* CREATE TABLE:: @code{CREATE TABLE} syntax * CREATE TABLE:: @code{CREATE TABLE} syntax
* ALTER TABLE:: @code{ALTER TABLE} syntax * ALTER TABLE:: @code{ALTER TABLE} syntax
* RENAME TABLE::
* DROP TABLE:: @code{DROP TABLE} syntax * DROP TABLE:: @code{DROP TABLE} syntax
* OPTIMIZE TABLE:: @code{OPTIMIZE TABLE} syntax * OPTIMIZE TABLE:: @code{OPTIMIZE TABLE} syntax
* CHECK TABLE:: @code{CHECK TABLE} syntax * CHECK TABLE:: @code{CHECK TABLE} syntax
...@@ -15973,15 +15982,16 @@ mysql> select COUNT(*) from student; ...@@ -15973,15 +15982,16 @@ mysql> select COUNT(*) from student;
@findex COUNT(DISTINCT) @findex COUNT(DISTINCT)
@findex DISTINCT @findex DISTINCT
@item COUNT(DISTINCT expr,[expr...]) @item COUNT(DISTINCT expr,[expr...])
Returns a count of the number of different values. Returns a count of the number of different not @code{NULL} values.
@example @example
mysql> select COUNT(DISTINCT results) from student; mysql> select COUNT(DISTINCT results) from student;
@end example @end example
In @strong{MySQL} you can get the number of distinct expressions combinations In @strong{MySQL} you can get the number of distinct expressions
by giving a list of expressions. In ANSI SQL you would have to do a combinations that doesn't contain NULL by giving a list of expressions.
concatenation of all expressions inside @code{CODE(DISTINCT ..)}. In ANSI SQL you would have to do a concatenation of all expressions
inside @code{CODE(DISTINCT ..)}.
@findex AVG() @findex AVG()
@item AVG(expr) @item AVG(expr)
...@@ -16547,7 +16557,7 @@ Certain other column type changes may occur if you compress a table ...@@ -16547,7 +16557,7 @@ Certain other column type changes may occur if you compress a table
using @code{myisampack}. @xref{Compressed format}. using @code{myisampack}. @xref{Compressed format}.
@findex ALTER TABLE @findex ALTER TABLE
@node ALTER TABLE, DROP TABLE, CREATE TABLE, Reference @node ALTER TABLE, RENAME TABLE, CREATE TABLE, Reference
@section @code{ALTER TABLE} syntax @section @code{ALTER TABLE} syntax
@example @example
...@@ -16565,7 +16575,7 @@ alter_specification: ...@@ -16565,7 +16575,7 @@ alter_specification:
or DROP [COLUMN] col_name or DROP [COLUMN] col_name
or DROP PRIMARY KEY or DROP PRIMARY KEY
or DROP INDEX index_name or DROP INDEX index_name
or RENAME [AS] new_tbl_name or RENAME [TO] new_tbl_name
or table_options or table_options
@end example @end example
...@@ -16621,9 +16631,10 @@ INDEX} are @strong{MySQL} extensions to ANSI SQL92. ...@@ -16621,9 +16631,10 @@ INDEX} are @strong{MySQL} extensions to ANSI SQL92.
The optional word @code{COLUMN} is a pure noise word and can be omitted. The optional word @code{COLUMN} is a pure noise word and can be omitted.
@item @item
If you use @code{ALTER TABLE tbl_name RENAME AS new_name} without any other If you use @code{ALTER TABLE tbl_name RENAME TO new_name} without any other
options, @strong{MySQL} simply renames the files that correspond to the table options, @strong{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}}.
@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
...@@ -16775,8 +16786,47 @@ sequence number be executing @code{SET INSERT_ID=#} before ...@@ -16775,8 +16786,47 @@ sequence number be executing @code{SET INSERT_ID=#} before
See also @xref{ALTER TABLE problems, , @code{ALTER TABLE} problems}. See also @xref{ALTER TABLE problems, , @code{ALTER TABLE} problems}.
@findex RENAME TABLE
@node RENAME TABLE, DROP TABLE, ALTER TABLE, Reference
@section @code{RENAME TABLE} syntax
@example
RENAME TABLE tbl_name as new_table_name[, tbl_name2 as new_table_name2,...]
@end example
The rename is done atomic, which means that if no other thread can
access any of the tables while the rename is running. This makes it
possible to replace a table with an empty one:
@example
CREATE TABLE new_table (...);
RENAME TABLE old_table TO backup_table, new_table as old_table;
@end example
The rename is done from left to right, which means that if you want to
swap two tables names, you have to do:
@example
RENAME TABLE old_table TO backup_table, new_table as old_table, backup_table as old_table;
@end example
Is long as two databases are on the same disk you can also do a rename
from a database to another:
@example
RENAME TABLE current_database.table_name TO other_database.table_name;
@end example
When you execute @code{RENAME}, you can't have any locked tables or active
transactions. You must also have the @code{ALTER TABLE} privilege on both
the old and the new table.
If @strong{MySQL} encounters any errors in a multiple table rename, it
will do a reverse rename for all renamed tables to get everything back
to the original state.
@findex DROP TABLE @findex DROP TABLE
@node DROP TABLE, OPTIMIZE TABLE, ALTER TABLE, Reference @node DROP TABLE, OPTIMIZE TABLE, RENAME TABLE, Reference
@section @code{DROP TABLE} syntax @section @code{DROP TABLE} syntax
@example @example
...@@ -19172,9 +19222,8 @@ may be a column name or a string containing the SQL @samp{%} and @samp{_} ...@@ -19172,9 +19222,8 @@ may be a column name or a string containing the SQL @samp{%} and @samp{_}
wildcard characters. wildcard characters.
If the column types are different than you expect them to be based on a If the column types are different than you expect them to be based on a
@code{CREATE TABLE} statement, note that @strong{MySQL} sometimes changes column @code{CREATE TABLE} statement, note that @strong{MySQL} sometimes
types. changes column types. @xref{Silent column changes}.
@xref{Silent column changes}.
@cindex Oracle compatibility @cindex Oracle compatibility
@cindex Compatibility, with Oracle @cindex Compatibility, with Oracle
...@@ -35350,6 +35399,10 @@ and will soon be declared beta, gamma and release. ...@@ -35350,6 +35399,10 @@ and will soon be declared beta, gamma and release.
@appendixsubsec Changes in release 3.23.23 @appendixsubsec Changes in release 3.23.23
@itemize @bullet @itemize @bullet
@item @item
Added atomic @code{RENAME} command.
@item
Don't count entries with @code{NULL} in @code{COUNT(DISTINCT ..)}.
@item
Changed @code{ALTER TABLE}, @code{LOAD DATA INFILE} on empty tables and Changed @code{ALTER TABLE}, @code{LOAD DATA INFILE} on empty tables and
@code{INSERT ... SELECT...} on empty tables to create non-unique indexs @code{INSERT ... SELECT...} on empty tables to create non-unique indexs
in a separate batch with sorting. This will make the above calls much in a separate batch with sorting. This will make the above calls much
...@@ -35372,7 +35425,9 @@ that don't have the @code{pthread_rwlock_rdlock} code. ...@@ -35372,7 +35425,9 @@ that don't have the @code{pthread_rwlock_rdlock} code.
When deleting rows with a non-unique key in a HEAP table, all rows weren't When deleting rows with a non-unique key in a HEAP table, all rows weren't
always deleted. always deleted.
@item @item
Fixed that BDB tables work on part keys. Fixed that @code{SELECT} on part keys works with BDB tables.
@item
Fixed that @code{INSERT INTO bdb_table ... SELECT} works with BDB tables.
@item @item
Check table now updates key statistics for the table. Check table now updates key statistics for the table.
@item @item
...@@ -35382,11 +35437,18 @@ will not be marked to be analyzed until they are updated in any way with ...@@ -35382,11 +35437,18 @@ will not be marked to be analyzed until they are updated in any way with
3.23.23 or newer. For older tables, you have to do @code{CHECK TABLE} 3.23.23 or newer. For older tables, you have to do @code{CHECK TABLE}
to update the key distribution. to update the key distribution.
@item @item
Fixed some minor privilege problems with @code{CHECK}, @code{ANALYZE},
@code{REPAIR} and @code{SHOW CREATE} commands.
@item
Added @code{CHANGE MASTER TO} command Added @code{CHANGE MASTER TO} command
@item @item
Added @code{FAST}, @code{QUICK} @code{EXTENDED} check types to Added @code{FAST}, @code{QUICK} @code{EXTENDED} check types to
@code{CHECK TABLES}. @code{CHECK TABLES}.
@item @item
Changed @code{myisamchk} so that @code{--fast} and
@code{--check-changed-tables} are also honored with @code{--sort-index} and
@code{--analyze}.
@item
Fixed fatal bug in @code{LOAD TABLE FROM MASTER} that did not lock the table during index re-build Fixed fatal bug in @code{LOAD TABLE FROM MASTER} that did not lock the table during index re-build
@item @item
@code{LOAD DATA INFILE} broke replication if the database was excluded from replication @code{LOAD DATA INFILE} broke replication if the database was excluded from replication
...@@ -38130,7 +38192,7 @@ Added new commands @code{CREATE DATABASE db_name} and @code{DROP ...@@ -38130,7 +38192,7 @@ Added new commands @code{CREATE DATABASE db_name} and @code{DROP
DATABASE db_name}. DATABASE db_name}.
@item @item
Added @code{RENAME} option to @code{ALTER TABLE}: @code{ALTER TABLE name Added @code{RENAME} option to @code{ALTER TABLE}: @code{ALTER TABLE name
RENAME AS new_name}. RENAME TO new_name}.
@item @item
@code{make_binary_distribution} now includes @file{libgcc.a} in @code{make_binary_distribution} now includes @file{libgcc.a} in
@file{libmysqlclient.a}. This should make linking work for people who don't @file{libmysqlclient.a}. This should make linking work for people who don't
...@@ -39474,7 +39536,7 @@ Fail safe replication. ...@@ -39474,7 +39536,7 @@ Fail safe replication.
@item @item
Optimize, test and document transactions safe tables Optimize, test and document transactions safe tables
@item @item
@code{RENAME table as table, table as table [,...]} @code{RENAME table to table, table to table [,...]}
@item @item
Allow users to change startup options. Allow users to change startup options.
@item @item
...@@ -39656,6 +39718,13 @@ A logfile analyzer that could parsed out information about which tables ...@@ -39656,6 +39718,13 @@ A logfile analyzer that could parsed out information about which tables
are hit most often, how often multi-table joins are executed, etc. It are hit most often, how often multi-table joins are executed, etc. It
should help users identify areas or table design that could be optimized should help users identify areas or table design that could be optimized
to execute much more efficient queries. to execute much more efficient queries.
@item
Add @code{SUM(DISTINCT)}
@item
Add @code{ANY()},@code{EVERY()} and @code{SOME()} group functions. In
ANSI SQL these only works on boolean columns, but we can extend these to
work on any columns/expressions by applying: value == 0 -> FALSE and
value <> 0 -> TRUE.
@end itemize @end itemize
@node TODO sometime, TODO unplanned, TODO future, TODO @node TODO sometime, TODO unplanned, TODO future, TODO
...@@ -1709,10 +1709,10 @@ CHARSET_COMP_CS_INIT="$CHARSET_COMP_CS_INIT ...@@ -1709,10 +1709,10 @@ CHARSET_COMP_CS_INIT="$CHARSET_COMP_CS_INIT
{ {
0, /* end-of-list marker */ 0, /* end-of-list marker */
NullS, NullS,
\"\", NULL,
\"\", NULL,
\"\", NULL,
\"\", NULL,
0, 0,
NULL, NULL,
NULL, NULL,
......
...@@ -113,6 +113,12 @@ ...@@ -113,6 +113,12 @@
#define HAVE_ATOMIC_SUB #define HAVE_ATOMIC_SUB
#endif #endif
/* In Linux-ia64 including atomic.h will give us an error */
#if defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__ia64__)
#undef HAVE_ATOMIC_ADD
#undef HAVE_ATOMIC_SUB
#endif
#if defined(_lint) && !defined(lint) #if defined(_lint) && !defined(lint)
#define lint #define lint
#endif #endif
...@@ -207,6 +213,7 @@ ...@@ -207,6 +213,7 @@
#endif #endif
/* Define void to stop lint from generating "null effekt" comments */ /* Define void to stop lint from generating "null effekt" comments */
#ifndef DONT_DEFINE_VOID
#ifdef _lint #ifdef _lint
int __void__; int __void__;
#define VOID(X) (__void__ = (int) (X)) #define VOID(X) (__void__ = (int) (X))
...@@ -214,6 +221,7 @@ int __void__; ...@@ -214,6 +221,7 @@ int __void__;
#undef VOID #undef VOID
#define VOID(X) (X) #define VOID(X) (X)
#endif #endif
#endif /* DONT_DEFINE_VOID */
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) #if defined(_lint) || defined(FORCE_INIT_OF_VARS)
#define LINT_INIT(var) var=0 /* No uninitialize-warning */ #define LINT_INIT(var) var=0 /* No uninitialize-warning */
...@@ -515,6 +523,8 @@ typedef long my_ptrdiff_t; ...@@ -515,6 +523,8 @@ typedef long my_ptrdiff_t;
#define NEAR /* Who needs segments ? */ #define NEAR /* Who needs segments ? */
#define FAR /* On a good machine */ #define FAR /* On a good machine */
#define HUGE_PTR #define HUGE_PTR
#endif
#ifndef STDCALL
#define STDCALL #define STDCALL
#endif #endif
......
...@@ -192,4 +192,5 @@ ...@@ -192,4 +192,5 @@
#define ER_MASTER_NET_READ 1189 #define ER_MASTER_NET_READ 1189
#define ER_MASTER_NET_WRITE 1190 #define ER_MASTER_NET_WRITE 1190
#define ER_FT_MATCHING_KEY_NOT_FOUND 1191 #define ER_FT_MATCHING_KEY_NOT_FOUND 1191
#define ER_ERROR_MESSAGES 192 #define ER_LOCK_OR_ACTIVE_TRANSACTION 1192
#define ER_ERROR_MESSAGES 193
...@@ -190,7 +190,7 @@ static struct option long_options[] = ...@@ -190,7 +190,7 @@ static struct option long_options[] =
static void print_version(void) static void print_version(void)
{ {
printf("%s Ver 1.29 for %s at %s\n",my_progname,SYSTEM_TYPE, printf("%s Ver 1.30 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE); MACHINE_TYPE);
} }
...@@ -295,7 +295,7 @@ static void get_options(register int *argc,register char ***argv) ...@@ -295,7 +295,7 @@ static void get_options(register int *argc,register char ***argv)
set_all_changeable_vars(changeable_vars); set_all_changeable_vars(changeable_vars);
if (isatty(fileno(stdout))) if (isatty(fileno(stdout)))
check_param.testflag|=T_WRITE_LOOP; check_param.testflag|=T_WRITE_LOOP;
while ((c=getopt_long(*argc,*argv,"acCdeif?lqrmosSTuUvVw#:b:D:k:O:R:A::t:", while ((c=getopt_long(*argc,*argv,"acCdeifF?lqrmosSTuUvVw#:b:D:k:O:R:A::t:",
long_options, &option_index)) != EOF) long_options, &option_index)) != EOF)
{ {
switch(c) { switch(c) {
...@@ -520,22 +520,42 @@ static int myisamchk(MI_CHECK *param, my_string filename) ...@@ -520,22 +520,42 @@ static int myisamchk(MI_CHECK *param, my_string filename)
We are using --fast and the table is closed properly We are using --fast and the table is closed properly
We are using --check-only-changed-tables and the table hasn't changed We are using --check-only-changed-tables and the table hasn't changed
*/ */
if (((param->testflag & T_CHECK_ONLY_CHANGED) && if (param->testflag & (T_FAST | T_CHECK_ONLY_CHANGED))
(share->state.changed & (STATE_CHANGED | STATE_CRASHED |
STATE_CRASHED_ON_REPAIR))) ||
(param->testflag & T_FAST) && share->state.open_count == 0)
{ {
if (!(param->testflag & T_SILENT) || param->testflag & T_INFO) my_bool need_to_check= mi_is_crashed(info) || share->state.open_count != 0;
printf("MyISAM file: %s is already checked\n",filename);
if (mi_close(info)) if ((param->testflag & (T_REP_BY_SORT | T_REP | T_SORT_RECORDS)) &&
((share->state.changed & (STATE_CHANGED | STATE_CRASHED |
STATE_CRASHED_ON_REPAIR) ||
!(param->testflag & T_CHECK_ONLY_CHANGED))))
need_to_check=1;
if ((param->testflag & T_STATISTICS) &&
(share->state.changed & STATE_NOT_ANALYZED))
need_to_check=1;
if ((param->testflag & T_SORT_INDEX) &&
(share->state.changed & STATE_NOT_SORTED_PAGES))
need_to_check=1;
if ((param->testflag & T_REP_BY_SORT) &&
(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))
need_to_check=1;
if ((param->testflag & T_CHECK_ONLY_CHANGED) &&
(share->state.changed & (STATE_CHANGED | STATE_CRASHED |
STATE_CRASHED_ON_REPAIR)))
need_to_check=1;
if (!need_to_check)
{ {
mi_check_print_error(param,"%d when closing MyISAM-table '%s'", if (!(param->testflag & T_SILENT) || param->testflag & T_INFO)
my_errno,filename); printf("MyISAM file: %s is already checked\n",filename);
DBUG_RETURN(1); if (mi_close(info))
{
mi_check_print_error(param,"%d when closing MyISAM-table '%s'",
my_errno,filename);
DBUG_RETURN(1);
}
DBUG_RETURN(0);
} }
DBUG_RETURN(0);
} }
if ((param->testflag & (T_REP_BY_SORT | T_REP | T_STATISTICS | if ((param->testflag & (T_REP_BY_SORT | T_REP | T_STATISTICS |
T_SORT_RECORDS | T_SORT_INDEX)) && T_SORT_RECORDS | T_SORT_INDEX)) &&
(((param->testflag & T_UNPACK) && (((param->testflag & T_UNPACK) &&
......
...@@ -48,5 +48,6 @@ int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag) ...@@ -48,5 +48,6 @@ int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag)
info->open_tables->table->s->keyinfo[inx].seg)) info->open_tables->table->s->keyinfo[inx].seg))
return my_errno; return my_errno;
} }
return 0;
} }
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
SerG SerG
*/ */
int _mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
enum ha_rkey_function search_flag, bool raw_key);
int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key, int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key,
uint key_len, enum ha_rkey_function search_flag) uint key_len, enum ha_rkey_function search_flag)
{ {
......
...@@ -224,7 +224,7 @@ if ($limits->{'unique_index'}) ...@@ -224,7 +224,7 @@ if ($limits->{'unique_index'})
$tmpvar^= ((($tmpvar + 63) + $i)*3 % $opt_loop_count); $tmpvar^= ((($tmpvar + 63) + $i)*3 % $opt_loop_count);
$tmp=$tmpvar % ($total_rows); $tmp=$tmpvar % ($total_rows);
$tmpquery = "$query ($tmp,1,2,'D')"; $tmpquery = "$query ($tmp,1,2,'D')";
if ($dbh->do($tmpquery)) if (!$dbh->do($tmpquery))
{ {
die "Didn't get an error when inserting duplicate record $tmp\n"; die "Didn't get an error when inserting duplicate record $tmp\n";
} }
......
2000-08-20 Michael Widenius <monty@mysql.com>
* Added memory as inline functions to THD to get them a bit faster
* Don't count entries with NULL in COUNT(DISTINCT ..)
2000-08-08 Michael Widenius <monty@mysql.com> 2000-08-08 Michael Widenius <monty@mysql.com>
* Changed ALTER TABLE and LOAD DATA INFILE to create non unique, small keys * Changed ALTER TABLE and LOAD DATA INFILE to create non unique, small keys
......
...@@ -66,7 +66,7 @@ mysqld_SOURCES = sql_lex.cc \ ...@@ -66,7 +66,7 @@ mysqld_SOURCES = sql_lex.cc \
records.cc filesort.cc handler.cc \ records.cc filesort.cc handler.cc \
ha_isam.cc ha_isammrg.cc ha_heap.cc \ ha_isam.cc ha_isammrg.cc ha_heap.cc \
ha_myisam.cc ha_myisammrg.cc ha_berkeley.cc \ ha_myisam.cc ha_myisammrg.cc ha_berkeley.cc \
sql_db.cc sql_table.cc sql_crypt.cc \ sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc \
sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \ sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \
sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
slave.cc \ slave.cc \
......
...@@ -839,6 +839,10 @@ bool Item_sum_count_distinct::add() ...@@ -839,6 +839,10 @@ bool Item_sum_count_distinct::add()
copy_fields(tmp_table_param); copy_fields(tmp_table_param);
copy_funcs(tmp_table_param->funcs); copy_funcs(tmp_table_param->funcs);
for (Field **field=table->field ; *field ; field++)
if ((*field)->is_real_null(0))
return 0; // Don't count NULL
if ((error=table->file->write_row(table->record[0]))) if ((error=table->file->write_row(table->record[0])))
{ {
if (error != HA_ERR_FOUND_DUPP_KEY && if (error != HA_ERR_FOUND_DUPP_KEY &&
......
...@@ -384,3 +384,87 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, ...@@ -384,3 +384,87 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
} }
return sql_lock; return sql_lock;
} }
/*****************************************************************************
** Lock table based on the name.
** This is used when we need total access to a closed, not open table
*****************************************************************************/
/*
Put a not open table with an old refresh version in the table cache.
This will force any other threads that uses the table to release it
as soon as possible.
One must have a lock on LOCK_open !
Return values:
< 0 error
== 0 table locked
> 0 table locked, but someone is using it
*/
int lock_table_name(THD *thd, TABLE_LIST *table_list)
{
TABLE *table;
char key[MAX_DBKEY_LENGTH];
uint key_length;
key_length=(uint) (strmov(strmov(key,table_list->db)+1,table_list->name)-key)+
1;
/* Only insert the table if we haven't insert it already */
for (table=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ;
table ;
table = (TABLE*) hash_next(&open_cache,(byte*) key,key_length))
if (table->in_use == thd)
return 0;
/* Create a table entry with the right key and with an old refresh version */
if (!(table= (TABLE*) thd->calloc(sizeof(*table)+key_length)))
return -1;
memcpy((table->table_cache_key= (char*) (table+1)), key, key_length);
table->key_length=key_length;
table->in_use=thd;
table_list->table=table;
if (hash_insert(&open_cache, (byte*) table))
return -1;
if (remove_table_from_cache(thd, table_list->db, table_list->name))
return 1; // Table is in use
return 0;
}
void unlock_table_name(THD *thd, TABLE_LIST *table_list)
{
if (table_list->table)
hash_delete(&open_cache, (gptr) table_list->table);
}
static bool locked_named_table(THD *thd, TABLE_LIST *table_list)
{
for ( ; table_list ; table_list=table_list->next)
{
if (table_list->table && table_is_used(table_list->table))
return 1;
}
return 0; // All tables are locked
}
bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list)
{
bool result=0;
while (locked_named_table(thd,table_list))
{
if (thd->killed)
{
result=1;
break;
}
wait_for_refresh(thd);
}
pthread_mutex_lock(&thd->mysys_var->mutex);
thd->mysys_var->current_mutex=0;
thd->mysys_var->current_cond=0;
pthread_mutex_unlock(&thd->mysys_var->mutex);
return result;
}
/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB /* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB
This file is public domain and comes with NO WARRANTY of any kind */ This file is public domain and comes with NO WARRANTY of any kind */
/* Modifikoval Petr najdr, snajdr@pvt.net, snajdr@cpress.cz v.0.01 /* Modifikoval Petr -Bnajdr, snajdr@pvt.net, snajdr@cpress.cz v.0.01 -A
ISO LATIN-8852-2 ISO LATIN-8852-2
Upravil Jan Pazdziora, adelton@fi.muni.cz Upravil Jan Pazdziora, adelton@fi.muni.cz
Tue Nov 18 17:53:55 MET 1997 verze 0.02 Tue Nov 18 17:53:55 MET 1997 verze 0.02
Rozeno podle 3.21.15c Jan Pazdziora, adelton@fi.muni.cz Roz-Beno podle 3.21.15c Jan Pazdziora, adelton@fi.muni.cz-A
Tue Dec 2 19:08:54 MET 1997 verze 0.03 Tue Dec 2 19:08:54 MET 1997 verze 0.03
Rozeno podle 3.21.29 Jan Pazdziora, adelton@fi.muni.cz Roz-Beno podle 3.21.29 Jan Pazdziora, adelton@fi.muni.cz-A
Thu May 7 17:40:49 MET DST 1998 verze 0.04 Thu May 7 17:40:49 MET DST 1998 verze 0.04
Podle verze 3.22.20 upravil Jan Pazdziora, adelton@fi.muni.cz Podle verze 3.22.20 upravil Jan Pazdziora, adelton@fi.muni.cz
Thu Apr 1 20:49:57 CEST 1999 Thu Apr 1 20:49:57 CEST 1999
...@@ -19,191 +19,192 @@ ...@@ -19,191 +19,192 @@
"isamchk", "isamchk",
"NE", "NE",
"ANO", "ANO",
"Nemohu vytvoit soubor '%-.64s' (chybov kd: %d)", "Nemohu vytvo-Bit soubor '%-.64s' (chybov kd: %d)",-A
"Nemohu vytvoit tabulku '%-.64s' (chybov kd: %d)", "Nemohu vytvo-Bit tabulku '%-.64s' (chybov kd: %d)",-A
"Nemohu vytvoit databzi '%-.64s', chyba %d", "Nemohu vytvo-Bit databzi '%-.64s', chyba %d",-A
"Nemohu vytvoit databzi '%-.64s', databze ji existuje", "Nemohu vytvo-Bit databzi '%-.64s', databze ji existuje",-A
"Nemohu zruit databzi '%-.64s', databze neexistuje", "Nemohu zru-Bit databzi '%-.64s', databze neexistuje",-A
"Chyba pi ruen databze (nemohu vymazat '%-.64s', chyba %d)", "Chyba p-Bi ruen databze (nemohu vymazat '%-.64s', chyba %d)",-A
"Chyba pi ruen databze (nemohu vymazat adres '%-.64s', chyba %d)", "Chyba p-Bi ruen databze (nemohu vymazat adres '%-.64s', chyba %d)",-A
"Chyba pi vmazu '%-.64s' (chybov kd: %d)", "Chyba p-Bi vmazu '%-.64s' (chybov kd: %d)",-A
"Nemohu st zznam v systmov tabulce", "Nemohu -Bst zznam v systmov tabulce",-A
"Nemohu zskat stav '%-.64s' (chybov kd: %d)", "Nemohu z-Bskat stav '%-.64s' (chybov kd: %d)",-A
"Chyba pi zjiovn pracovn adres (chybov kd: %d)", "Chyba p-Bi zjiovn pracovn adres (chybov kd: %d)",-A
"Nemohu uzamknout soubor (chybov kd: %d)", "Nemohu uzamknout soubor (chybov-B kd: %d)",-A
"Nemohu otevt soubor '%-.64s' (chybov kd: %d)", "Nemohu otev-Bt soubor '%-.64s' (chybov kd: %d)",-A
"Nemohu najt soubor '%-.64s' (chybov kd: %d)", "Nemohu naj-Bt soubor '%-.64s' (chybov kd: %d)",-A
"Nemohu st adres '%-.64s' (chybov kd: %d)", "Nemohu -Bst adres '%-.64s' (chybov kd: %d)",-A
"Nemohu zmnit adres na '%-.64s' (chybov kd: %d)", "Nemohu zm-Bnit adres na '%-.64s' (chybov kd: %d)",-A
"Zznam byl zmnn od poslednho ten v tabulce '%-.64s'", "Z-Bznam byl zmnn od poslednho ten v tabulce '%-.64s'",-A
"Disk je pln (%s), ekm na uvolnn njakho msta ...", "Disk je pln-B (%s), ekm na uvolnn njakho msta ...",-A
"Nemohu zapsat, zdvojen kl v tabulce '%-.64s'", "Nemohu zapsat, zdvojen-B kl v tabulce '%-.64s'",-A
"Chyba pi zavrn '%-.64s' (chybov kd: %d)", "Chyba p-Bi zavrn '%-.64s' (chybov kd: %d)",-A
"Chyba pi ten souboru '%-.64s' (chybov kd: %d)", "Chyba p-Bi ten souboru '%-.64s' (chybov kd: %d)",-A
"Chyba pi pejmenovn '%-.64s' na '%-.64s' (chybov kd: %d)", "Chyba p-Bi pejmenovn '%-.64s' na '%-.64s' (chybov kd: %d)",-A
"Chyba pi zpisu do souboru '%-.64s' (chybov kd: %d)", "Chyba p-Bi zpisu do souboru '%-.64s' (chybov kd: %d)",-A
"'%-.64s' je zamen proti zmnm", "'%-.64s' je zam-Ben proti zmnm",-A
"Tdn perueno", "T-Bdn perueno",-A
"Pohled '%-.64s' pro '%-.64s' neexistuje", "Pohled '%-.64s' pro '%-.64s' neexistuje",
"Obsluha tabulky vrtila chybu %d", "Obsluha tabulky vr-Btila chybu %d",-A
"Obsluha tabulky '%-.64s' nem tento parametr", "Obsluha tabulky '%-.64s' nem-B tento parametr",-A
"Nemohu najt zznam v '%-.64s'", "Nemohu naj-Bt zznam v '%-.64s'",-A
"Nesprvn informace v souboru '%-.64s'", "Nespr-Bvn informace v souboru '%-.64s'",-A
"Nesprvn kl pro tabulku '%-.64s'. Pokuste se ho opravit", "Nespr-Bvn kl pro tabulku '%-.64s'. Pokuste se ho opravit",-A
"Star klov soubor pro '%-.64s'. Opravte ho.", "Star-B klov soubor pro '%-.64s'. Opravte ho.",-A
"'%-.64s' je jen pro ten", "'%-.64s' je jen pro -Bten",-A
"Mlo pamti. Pestartujte daemona a zkuste znovu (je poteba %d byt)", "M-Blo pamti. Pestartujte daemona a zkuste znovu (je poteba %d byt)",-A
"Mlo pamti pro tdn. Zvyte velikost tdcho bufferu", "M-Blo pamti pro tdn. Zvyte velikost tdcho bufferu",-A
"Neoekvan konec souboru pi ten '%-.64s' (chybov kd: %d)", "Neo-Bekvan konec souboru pi ten '%-.64s' (chybov kd: %d)",-A
"Pli mnoho spojen", "P-Bli mnoho spojen",-A
"Mlo prostoru/pamti pro thread", "M-Blo prostoru/pamti pro thread",-A
"Nemohu zjistit jmno stroje pro Vai adresu", "Nemohu zjistit jm-Bno stroje pro Vai adresu",-A
"Chyba pi ustavovn spojen", "Chyba p-Bi ustavovn spojen",-A
"Pstup pro uivatele '%-.32s@%-.64s' k databzi '%-.64s' nen povolen", "P-Bstup pro uivatele '%-.32s@%-.64s' k databzi '%-.64s' nen povolen",-A
"Pstup pro uivatele '%-.32s@%-.64s' (s heslem %s)", "P-Bstup pro uivatele '%-.32s@%-.64s' (s heslem %s)",-A
"Nebyla vybrna dn databze", "Nebyla vybr-Bna dn databze",-A
"Neznm pkaz", "Nezn-Bm pkaz",-A
"Sloupec '%-.64s' neme bt null", "Sloupec '%-.64s' nem-Be bt null",-A
"Neznm databze '%-.64s'", "Nezn-Bm databze '%-.64s'",-A
"Tabulka '%-.64s' ji existuje", "Tabulka '%-.64s' ji-B existuje",-A
"Neznm tabulka '%-.64s'", "Nezn-Bm tabulka '%-.64s'",-A
"Sloupec '%-.64s' v %s nen zcela jasn", "Sloupec '%-.64s' v %s nen-B zcela jasn",-A
"Probh ukonovn prce serveru", "Prob-Bh ukonovn prce serveru",-A
"Neznm sloupec '%-.64s' v %s", "Nezn-Bm sloupec '%-.64s' v %s",-A
"Pouit '%-.64s' nebylo v group by", "Pou-Bit '%-.64s' nebylo v group by",-A
"Nemohu pout group na '%-.64s'", "Nemohu pou-Bt group na '%-.64s'",-A
"Pkaz obsahuje zrove funkci sum a sloupce", "P-Bkaz obsahuje zrove funkci sum a sloupce",-A
"Poet sloupc neodpovd zadan hodnot", "Po-Bet sloupc neodpovd zadan hodnot",-A
"Jmno identifiktoru '%-.64s' je pli dlouh", "Jm-Bno identifiktoru '%-.64s' je pli dlouh",-A
"Zdvojen jmno sloupce '%-.64s'", "Zdvojen-B jmno sloupce '%-.64s'",-A
"Zdvojen jmno kle '%-.64s'", "Zdvojen-B jmno kle '%-.64s'",-A
"Zvojen kl '%-.64s' (slo kle %d)", "Zvojen-B kl '%-.64s' (slo kle %d)",-A
"Chybn specifikace sloupce '%-.64s'", "Chybn-B specifikace sloupce '%-.64s'",-A
"%s blzko '%-.64s' na dku %d", "%s bl-Bzko '%-.64s' na dku %d",-A
"Vsledek dotazu je przdn", "V-Bsledek dotazu je przdn",-A
"Nejednoznan tabulka/alias: '%-.64s'", "Nejednozna-Bn tabulka/alias: '%-.64s'",-A
"Chybn defaultn hodnota pro '%-.64s'", "Chybn-B defaultn hodnota pro '%-.64s'",-A
"Definovno vce primrnch kl", "Definov-Bno vce primrnch kl",-A
"Zadno pli mnoho kl, je povoleno nejvce %d kl", "Zad-Bno pli mnoho kl, je povoleno nejvce %d kl",-A
"Zadno pli mnoho st kl, je povoleno nejvce %d st", "Zad-Bno pli mnoho st kl, je povoleno nejvce %d st",-A
"Zadan kl byl pli dlouh, nejvt dlka kle je %d", "Zadan-B kl byl pli dlouh, nejvt dlka kle je %d",-A
"Klov sloupec '%-.64s' v tabulce neexistuje", "Kl-Bov sloupec '%-.64s' v tabulce neexistuje",-A
"Blob sloupec '%-.64s' neme bt pouit jako kl", "Blob sloupec '%-.64s' nem-Be bt pouit jako kl",-A
"Pli velk dlka sloupce '%-.64s' (nejvce %d). Pouijte BLOB", "P-Bli velk dlka sloupce '%-.64s' (nejvce %d). Pouijte BLOB",-A
"Mete mt pouze jedno AUTO pole a to mus bt definovno jako kl", "M-Bete mt pouze jedno AUTO pole a to mus bt definovno jako kl",-A
"%s: pipraven na spojen\n", "%s: p-Bipraven na spojen\n",-A
"%s: normln ukonen\n", "%s: norm-Bln ukonen\n",-A
"%s: pijat signal %d, konm\n", "%s: p-Bijat signal %d, konm\n",-A
"%s: ukonen prce hotovo\n", "%s: ukon-Ben prce hotovo\n",-A
"%s: nsiln uzaven threadu %ld uivatele '%-.64s'\n", "%s: n-Bsiln uzaven threadu %ld uivatele '%-.64s'\n",-A
"Nemohu vytvoit IP socket", "Nemohu vytvo-Bit IP socket",-A
"Tabulka '%-.64s' nem index odpovdajc CREATE INDEX. Vytvote tabulku znovu", "Tabulka '%-.64s' nem-B index odpovdajc CREATE INDEX. Vytvote tabulku znovu",-A
"Argument separtoru poloek nebyl oekvn. Pette si manul", "Argument separ-Btoru poloek nebyl oekvn. Pette si manul",-A
"Nen mon pout pevn rowlength s BLOBem. Pouijte 'fields terminated by'.", "Nen-B mon pout pevn rowlength s BLOBem. Pouijte 'fields terminated by'.",-A
"Soubor '%-.64s' mus bt v adresi databze nebo iteln pro vechny", "Soubor '%-.64s' mus-B bt v adresi databze nebo iteln pro vechny",-A
"Soubor '%-.64s' ji existuje", "Soubor '%-.64s' ji-B existuje",-A
"Zznam: %ld Vymazno: %ld Peskoeno: %ld Varovn: %ld", "Z-Bznam: %ld Vymazno: %ld Peskoeno: %ld Varovn: %ld",-A
"Zznam: %ld Zdvojench: %ld", "Z-Bznam: %ld Zdvojench: %ld",-A
"Chybn podst kle -- nen to etzec nebo je del ne dlka sti kle", "Chybn-B podst kle -- nen to etzec nebo je del ne dlka sti kle",-A
"Nen mon vymazat vechny poloky s ALTER TABLE. Pouijte DROP TABLE", "Nen-B mon vymazat vechny poloky s ALTER TABLE. Pouijte DROP TABLE",-A
"Nemohu zruit '%-.64s' (provst DROP). Zkontrolujte, zda neexistuj zznamy/kle", "Nemohu zru-Bit '%-.64s' (provst DROP). Zkontrolujte, zda neexistuj zznamy/kle",-A
"Zznam: %ld Zdvojench: %ld Varovn: %ld", "Z-Bznam: %ld Zdvojench: %ld Varovn: %ld",-A
"INSERT TABLE '%-.64s' nen dovoleno v seznamu tabulek FROM", "INSERT TABLE '%-.64s' nen-B dovoleno v seznamu tabulek FROM",-A
"Neznm identifikace threadu: %lu", "Nezn-Bm identifikace threadu: %lu",-A
"Nejste vlastnkem threadu %lu", "Nejste vlastn-Bkem threadu %lu",-A
"Nejsou pouity dn tabulky", "Nejsou pou-Bity dn tabulky",-A
"Pli mnoho etzc pro sloupec %s a SET", "P-Bli mnoho etzc pro sloupec %s a SET",-A
"Nemohu vytvoit jednoznan jmno logovacho souboru %s.(1-999)\n", "Nemohu vytvo-Bit jednoznan jmno logovacho souboru %s.(1-999)\n",-A
"Tabulka '%-.64s' byla zamena s READ a neme bt zmnna", "Tabulka '%-.64s' byla zam-Bena s READ a neme bt zmnna",-A
"Tabulka '%-.64s' nebyla zamena s LOCK TABLES", "Tabulka '%-.64s' nebyla zam-Bena s LOCK TABLES",-A
"Blob poloka '%-.64s' neme mt defaultn hodnotu", "Blob polo-Bka '%-.64s' neme mt defaultn hodnotu",-A
"Neppustn jmno databze '%-.64s'", "Nep-Bpustn jmno databze '%-.64s'",-A
"Neppustn jmno tabulky '%-.64s'", "Nep-Bpustn jmno tabulky '%-.64s'",-A
"Zadan SELECT by prochzel pli mnoho zznam a trval velmi dlouho. Zkontrolujte tvar WHERE a je-li SELECT v podku, pouijte SET OPTION SQL_BIG_SELECTS=1", "Zadan-B SELECT by prochzel pli mnoho zznam a trval velmi dlouho. Zkontrolujte tvar WHERE a je-li SELECT v podku, pouijte SET OPTION SQL_BIG_SELECTS=1",-A
"Neznm chyba", "Nezn-Bm chyba",-A
"Neznm procedura %s", "Nezn-Bm procedura %s",-A
"Chybn poet parametr procedury %s", "Chybn-B poet parametr procedury %s",-A
"Chybn parametry procedury %s", "Chybn-B parametry procedury %s",-A
"Neznm tabulka '%-.64s' v %s", "Nezn-Bm tabulka '%-.64s' v %s",-A
"Poloka '%-.64s' je zadna dvakrt", "Polo-Bka '%-.64s' je zadna dvakrt",-A
"Nesprvn pouit funkce group", "Nespr-Bvn pouit funkce group",-A
"Tabulka '%-.64s' pouv rozen, kter v tto verzi MySQL nen", "Tabulka '%-.64s' pou-Bv rozen, kter v tto verzi MySQL nen",-A
"Tabulka mus mt alespo jeden sloupec", "Tabulka mus-B mt alespo jeden sloupec",-A
"Tabulka '%-.64s' je pln", "Tabulka '%-.64s' je pln-B",-A
"Neznm znakov sada: '%-.64s'", "Nezn-Bm znakov sada: '%-.64s'",-A
"Pli mnoho tabulek, MySQL jich me mt v joinu jen %d", "P-Bli mnoho tabulek, MySQL jich me mt v joinu jen %d",-A
"Pli mnoho poloek", "P-Bli mnoho poloek",-A
"dek je pli velk. Maximln velikost dku, nepotaje poloky blob, je %d. Muste zmnit nkter poloky na blob", "-Bdek je pli velk. Maximln velikost dku, nepotaje poloky blob, je %d. Muste zmnit nkter poloky na blob",-A
"Peteen zsobnku threadu: pouito %ld z %ld. Pouijte 'mysqld -O thread_stack=#' k zadn vtho zsobnku", "P-Beteen zsobnku threadu: pouito %ld z %ld. Pouijte 'mysqld -O thread_stack=#' k zadn vtho zsobnku",-A
"V OUTER JOIN byl nalezen kov odkaz. Provte ON podmnky", "V OUTER JOIN byl nalezen k-Bov odkaz. Provte ON podmnky",-A
"Sloupec '%-.32s' je pouit s UNIQUE nebo INDEX, ale nen definovn jako NOT NULL", "Sloupec '%-.32s' je pou-Bit s UNIQUE nebo INDEX, ale nen definovn jako NOT NULL",-A
"Nemohu nast funkci '%-.64s'", "Nemohu na-Bst funkci '%-.64s'",-A
"Nemohu inicializovat funkci '%-.64s'; %-.80s", "Nemohu inicializovat funkci '%-.64s'; %-.80s",
"Pro sdlenou knihovnu nejsou povoleny cesty", "Pro sd-Blenou knihovnu nejsou povoleny cesty",-A
"Funkce '%-.64s' ji existuje", "Funkce '%-.64s' ji-B existuje",-A
"Nemohu otevt sdlenou knihovnu '%-.64s' (errno: %d %s)", "Nemohu otev-Bt sdlenou knihovnu '%-.64s' (errno: %d %s)",-A
"Nemohu najt funkci '%-.64s' v knihovn'", "Nemohu naj-Bt funkci '%-.64s' v knihovn'",-A
"Funkce '%-.64s' nen definovna", "Funkce '%-.64s' nen-B definovna",-A
"Stroj '%-.64s' je zablokovn kvli mnoha chybm pi pipojovn. Odblokujete pouitm 'mysqladmin flush-hosts'", "Stroj '%-.64s' je zablokov-Bn kvli mnoha chybm pi pipojovn. Odblokujete pouitm 'mysqladmin flush-hosts'",-A
"Stroj '%-.64s' nem povoleno se k tomuto MySQL serveru pipojit", "Stroj '%-.64s' nem-B povoleno se k tomuto MySQL serveru pipojit",-A
"Pouvte MySQL jako anonymn uivatel a anonymn uivatel nemaj povoleno mnit hesla", "Pou-Bvte MySQL jako anonymn uivatel a anonymn uivatel nemaj povoleno mnit hesla",-A
"Na zmnu hesel ostatnm muste mt prvo provst update tabulek v databzi mysql", "Na zm-Bnu hesel ostatnm muste mt prvo provst update tabulek v databzi mysql",-A
"V tabulce user nen dn odpovdajc dek", "V tabulce user nen-B dn odpovdajc dek",-A
"Nalezench dk: %ld Zmnno: %ld Varovn: %ld", "Nalezen-Bch dk: %ld Zmnno: %ld Varovn: %ld",-A
"Nemohu vytvoit nov thread (errno %d). Pokud je jet njak voln pam, podvejte se do manulu na st o chybch specifickch pro jednotliv operan systmy", "Nemohu vytvo-Bit nov thread (errno %d). Pokud je jet njak voln pam, podvejte se do manulu na st o chybch specifickch pro jednotliv operan systmy",-A
"Poet sloupc neodpovd potu hodnot na dku %ld", "Po-Bet sloupc neodpovd potu hodnot na dku %ld",-A
"Nemohu znovuotevt tabulku: '%-.64s', "Nemohu znovuotev-Bt tabulku: '%-.64s',-A
"Neplatn uit hodnoty NULL", "Neplatn-B uit hodnoty NULL",-A
"Regulrn vraz vrtil chybu '%-.64s'", "Regul-Brn vraz vrtil chybu '%-.64s'",-A
"Pokud nen dn GROUP BY klauzule, nen dovoleno souasn pouit GROUP poloek (MIN(),MAX(),COUNT()...) s ne GROUP polokami", "Pokud nen-B dn GROUP BY klauzule, nen dovoleno souasn pouit GROUP poloek (MIN(),MAX(),COUNT()...) s ne GROUP polokami",-A
"Neexistuje odpovdajc grant pro uivatele '%-.32s' na stroji '%-.64s'", "Neexistuje odpov-Bdajc grant pro uivatele '%-.32s' na stroji '%-.64s'",-A
"%-.16s pkaz nepstupn pro uivatele: '%-.32s@%-.64s' pro tabulku '%-.64s'", "%-.16s p-Bkaz nepstupn pro uivatele: '%-.32s@%-.64s' pro tabulku '%-.64s'",-A
"%-.16s pkaz nepstupn pro uivatele: '%-.32s@%-.64s' pro sloupec '%-.64s' v tabulce '%-.64s'", "%-.16s p-Bkaz nepstupn pro uivatele: '%-.32s@%-.64s' pro sloupec '%-.64s' v tabulce '%-.64s'",-A
"Neplatn pkaz GRANT/REVOKE. Prosm, pette si v manulu, jak privilegia je mon pout.", "Neplatn-B pkaz GRANT/REVOKE. Prosm, pette si v manulu, jak privilegia je mon pout.",-A
"Argument pkazu GRANT uivatel nebo stroj je pli dlouh", "Argument p-Bkazu GRANT uivatel nebo stroj je pli dlouh",-A
"Tabulka '%-64s.%s' neexistuje", "Tabulka '%-64s.%s' neexistuje",
"Neexistuje odpovdajc grant pro uivatele '%-.32s' na stroji '%-.64s' pro tabulku '%-.64s'", "Neexistuje odpov-Bdajc grant pro uivatele '%-.32s' na stroji '%-.64s' pro tabulku '%-.64s'",-A
"Pouit pkaz nen v tto verzi MySQL povolen", "Pou-Bit pkaz nen v tto verzi MySQL povolen",-A
"Vae syntaxe je njak divn", "Va-Be syntaxe je njak divn",-A
"Zpodn insert threadu nebyl schopen zskat poadovan zmek pro tabulku %-.64s", "Zpo-Bdn insert threadu nebyl schopen zskat poadovan zmek pro tabulku %-.64s",-A
"Pli mnoho zpodnch thread", "P-Bli mnoho zpodnch thread",-A
"Zrueno spojen %ld do databze: '%-.64s' uivatel: '%-.64s' (%s)", "Zru-Beno spojen %ld do databze: '%-.64s' uivatel: '%-.64s' (%s)",-A
"Zjitn pchoz packet del ne 'max_allowed_packet'", "Zji-Btn pchoz packet del ne 'max_allowed_packet'",-A
"Zjitna chyba pi ten z roury spojen", "Zji-Btna chyba pi ten z roury spojen",-A
"Zjitna chyba fcntl()", "Zji-Btna chyba fcntl()",-A
"Pchoz packety v chybnm poad", "P-Bchoz packety v chybnm poad",-A
"Nemohu rozkomprimovat komunikan packet", "Nemohu rozkomprimovat komunika-Bn packet",-A
"Zjitna chyba pi ten komunikanho packetu", "Zji-Btna chyba pi ten komunikanho packetu",-A
"Zjitn timeout pi ten komunikanho packetu", "Zji-Btn timeout pi ten komunikanho packetu",-A
"Zjitna chyba pi zpisu komunikanho packetu", "Zji-Btna chyba pi zpisu komunikanho packetu",-A
"Zjitn timeout pi zpisu komunikanho packetu", "Zji-Btn timeout pi zpisu komunikanho packetu",-A
"Vsledn etzec je del ne max_allowed_packet", "V-Bsledn etzec je del ne max_allowed_packet",-A
"Typ pouit tabulky nepodporuje BLOB/TEXT sloupce", "Typ pou-Bit tabulky nepodporuje BLOB/TEXT sloupce",-A
"Typ pouit tabulky nepodporuje AUTO_INCREMENT sloupce", "Typ pou-Bit tabulky nepodporuje AUTO_INCREMENT sloupce",-A
"INSERT DELAYED nen mono s tabulkou '%-.64s' pout, protoe je zamen pomoc LOCK TABLES", "INSERT DELAYED nen-B mono s tabulkou '%-.64s' pout, protoe je zamen pomoc LOCK TABLES",-A
"Nesprvn jmno sloupce '%-.100s'", "Nespr-Bvn jmno sloupce '%-.100s'",-A
"Handler pouit tabulky neum indexovat sloupce '%-.64s'", "Handler pou-Bit tabulky neum indexovat sloupce '%-.64s'",-A
"Vechny tabulky v MERGE tabulce nejsou definovny stejn", "V-Bechny tabulky v MERGE tabulce nejsou definovny stejn",-A
"Kvli unique constraintu nemozu zapsat do tabulky '%-.64s'", "Kv-Bli unique constraintu nemozu zapsat do tabulky '%-.64s'",-A
"BLOB sloupec '%-.64s' je pouit ve specifikaci kle bez dlky", "BLOB sloupec '%-.64s' je pou-Bit ve specifikaci kle bez dlky",-A
+"V-Bechny sti primrnho kle musej bt NOT NULL; pokud potebujete NULL, pouijte UNIQUE",-A "V-Bechny sti primrnho kle musej bt NOT NULL; pokud potebujete NULL, pouijte UNIQUE",-A
+"V-Bsledek obsahuje vce ne jeden dek",-A "V-Bsledek obsahuje vce ne jeden dek",-A
+"Tento typ tabulky vy-Baduje primrn kl",-A "Tento typ tabulky vy-Baduje primrn kl",-A
+"Tato verze MySQL nen-B zkompilovna s podporou RAID",-A "Tato verze MySQL nen-B zkompilovna s podporou RAID",-A
+"Update tabulky bez WHERE s kl-Bem nen v mdu bezpench update dovoleno",-A "Update tabulky bez WHERE s kl-Bem nen v mdu bezpench update dovoleno",-A
+"Kl-B '%-.64s' v tabulce '%-.64s' neexistuje",-A "Kl-B '%-.64s' v tabulce '%-.64s' neexistuje",-A
+"Nemohu otev-Bt tabulku",-A "Nemohu otev-Bt tabulku",-A
+"Handler tabulky nepodporuje check/repair", "Handler tabulky nepodporuje check/repair",
"You are not allowed to execute this command in a transaction", "Proveden-B tohoto pkazu nen v transakci dovoleno",-A
"Got error %d during COMMIT", "Chyba %d p-Bi COMMIT",-A
"Got error %d during ROLLBACK", "Chyba %d p-Bi ROLLBACK",-A
"Got error %d during FLUSH_LOGS", "Chyba %d p-Bi FLUSH_LOGS",-A
"Got error %d during CHECKPOINT", "Chyba %d p-Bi CHECKPOINT",-A
"Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: `%-.64s' (%-.64s)", "Spojen-B %ld do databze: '%-.64s' uivatel: '%-.32s' stroj: `%-.64s' (%-.64s) bylo perueno",-A
"The handler for the table does not support binary table dump", "Handler tabulky nepodporuje bin-Brn dump",-A
"Binlog closed while trying to FLUSH MASTER", "Binlog uzav-Ben pi pokusu o FLUSH MASTER",-A
"Failed rebuilding the index of dumped table '%-.64s'", "P-Bebudovn indexu dumpnut tabulky '%-.64s' nebylo spn",-A
"Error from master: '%-.64s'", "Chyba masteru: '%-.64s'",
"Net error reading from master", "S-Bov chyba pi ten z masteru",-A
"Net error writing to master", "S-Bov chyba pi zpisu na master",-A
"Can't find FULLTEXT index matching the column list", "-Bdn sloupec nem vytvoen fulltextov index",-A
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -196,3 +196,4 @@ ...@@ -196,3 +196,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -193,3 +193,4 @@ ...@@ -193,3 +193,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -193,3 +193,4 @@ ...@@ -193,3 +193,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -197,3 +197,4 @@ ...@@ -197,3 +197,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -193,3 +193,4 @@ ...@@ -193,3 +193,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -196,3 +196,4 @@ ...@@ -196,3 +196,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -193,3 +193,4 @@ ...@@ -193,3 +193,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -195,3 +195,4 @@ ...@@ -195,3 +195,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -193,3 +193,4 @@ ...@@ -193,3 +193,4 @@
"Errore di rete ricevendo dal master", "Errore di rete ricevendo dal master",
"Errore di rete inviando al master", "Errore di rete inviando al master",
"Impossibile trovare un indice FULLTEXT che corrisponda all'elenco delle colonne", "Impossibile trovare un indice FULLTEXT che corrisponda all'elenco delle colonne",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -195,3 +195,4 @@ ...@@ -195,3 +195,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -193,3 +193,4 @@ ...@@ -193,3 +193,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -195,3 +195,4 @@ ...@@ -195,3 +195,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -195,3 +195,4 @@ ...@@ -195,3 +195,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -197,3 +197,4 @@ ...@@ -197,3 +197,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -193,3 +193,4 @@ ...@@ -193,3 +193,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -197,3 +197,4 @@ ...@@ -197,3 +197,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -196,3 +196,4 @@ ...@@ -196,3 +196,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"FULLTEXT , , ", "FULLTEXT , , ",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -201,3 +201,4 @@ ...@@ -201,3 +201,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -194,3 +194,4 @@ ...@@ -194,3 +194,4 @@
"Net error reading from master", "Net error reading from master",
"Net error writing to master", "Net error writing to master",
"Can't find FULLTEXT index matching the column list", "Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -193,3 +193,5 @@ ...@@ -193,3 +193,5 @@
"Fick nätverksfel vid läsning från master", "Fick nätverksfel vid läsning från master",
"Fick nätverksfel vid skrivning till master", "Fick nätverksfel vid skrivning till master",
"Hittar inte ett FULLTEXT index i kolumnlist", "Hittar inte ett FULLTEXT index i kolumnlist",
#ER_LOCK_OR_ACTIVE_TRANSACTION
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -193,3 +193,4 @@ ...@@ -193,3 +193,4 @@
"Fick nätverksfel vid läsning från master", "Fick nätverksfel vid läsning från master",
"Fick nätverksfel vid skrivning till master", "Fick nätverksfel vid skrivning till master",
"Hittar inte ett FULLTEXT index i kolumnlist", "Hittar inte ett FULLTEXT index i kolumnlist",
"Can't execute the given command because you have active locked tables or an active transaction",
...@@ -406,7 +406,7 @@ static int init_slave_thread(THD* thd) ...@@ -406,7 +406,7 @@ static int init_slave_thread(THD* thd)
if (init_thr_lock() || if (init_thr_lock() ||
my_pthread_setspecific_ptr(THR_THD, thd) || my_pthread_setspecific_ptr(THR_THD, thd) ||
my_pthread_setspecific_ptr(THR_MALLOC, &thd->alloc) || my_pthread_setspecific_ptr(THR_MALLOC, &thd->mem_root) ||
my_pthread_setspecific_ptr(THR_NET, &thd->net)) my_pthread_setspecific_ptr(THR_NET, &thd->net))
{ {
close_connection(&thd->net,ER_OUT_OF_RESOURCES); // is this needed? close_connection(&thd->net,ER_OUT_OF_RESOURCES); // is this needed?
...@@ -422,7 +422,7 @@ static int init_slave_thread(THD* thd) ...@@ -422,7 +422,7 @@ static int init_slave_thread(THD* thd)
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
#endif #endif
thd->alloc.free=thd->alloc.used=0; thd->mem_root.free=thd->mem_root.used=0; // Probably not needed
if (thd->max_join_size == (ulong) ~0L) if (thd->max_join_size == (ulong) ~0L)
thd->options |= OPTION_BIG_SELECTS; thd->options |= OPTION_BIG_SELECTS;
...@@ -557,7 +557,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -557,7 +557,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
{ {
Query_log_event* qev = (Query_log_event*)ev; Query_log_event* qev = (Query_log_event*)ev;
int q_len = qev->q_len; int q_len = qev->q_len;
init_sql_alloc(&thd->alloc, 8192); init_sql_alloc(&thd->mem_root, 8192);
thd->db = (char*)qev->db; thd->db = (char*)qev->db;
if(db_ok(thd->db, replicate_do_db, replicate_ignore_db)) if(db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{ {
...@@ -602,13 +602,13 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -602,13 +602,13 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
thd->db = 0;// prevent db from being freed thd->db = 0;// prevent db from being freed
thd->query = 0; // just to be sure thd->query = 0; // just to be sure
close_thread_tables(thd); close_thread_tables(thd);
free_root(&thd->alloc); free_root(&thd->mem_root);
if(thd->query_error) if (thd->query_error)
{ {
sql_print_error("Slave: error running query '%s' ", sql_print_error("Slave: error running query '%s' ",
qev->query); qev->query);
return 1; return 1;
} }
delete ev; delete ev;
if(thd->fatal_error) if(thd->fatal_error)
...@@ -626,7 +626,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -626,7 +626,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
case LOAD_EVENT: case LOAD_EVENT:
{ {
Load_log_event* lev = (Load_log_event*)ev; Load_log_event* lev = (Load_log_event*)ev;
init_sql_alloc(&thd->alloc, 8192); init_sql_alloc(&thd->mem_root, 8192);
thd->db = (char*)lev->db; thd->db = (char*)lev->db;
thd->query = 0; thd->query = 0;
thd->query_error = 0; thd->query_error = 0;
......
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
#include <io.h> #include <io.h>
#endif #endif
#define MAX_DBKEY_LENGTH (FN_LEN*2+2)
static int key_cache_used=0; static int key_cache_used=0;
TABLE *unused_tables; /* Used by mysql_test */ TABLE *unused_tables; /* Used by mysql_test */
HASH open_cache; /* Used by mysql_test */ HASH open_cache; /* Used by mysql_test */
...@@ -120,7 +118,7 @@ static byte *cache_key(const byte *record,uint *length, ...@@ -120,7 +118,7 @@ static byte *cache_key(const byte *record,uint *length,
void table_cache_init(void) void table_cache_init(void)
{ {
VOID(hash_init(&open_cache,table_cache_size,0,0,cache_key, VOID(hash_init(&open_cache,table_cache_size+16,0,0,cache_key,
(void (*)(void*)) free_cache_entry,0)); (void (*)(void*)) free_cache_entry,0));
mysql_rm_tmp_tables(); mysql_rm_tmp_tables();
} }
...@@ -1234,7 +1232,7 @@ void close_old_data_files(THD *thd, TABLE *table, bool abort_locks) ...@@ -1234,7 +1232,7 @@ void close_old_data_files(THD *thd, TABLE *table, bool abort_locks)
if the table is closed if the table is closed
*/ */
static bool table_is_used(TABLE *table) bool table_is_used(TABLE *table)
{ {
do do
{ {
...@@ -2171,4 +2169,3 @@ int setup_ftfuncs(THD *thd,TABLE_LIST *tables, List<Item_func_match> &ftfuncs) ...@@ -2171,4 +2169,3 @@ int setup_ftfuncs(THD *thd,TABLE_LIST *tables, List<Item_func_match> &ftfuncs)
return 0; return 0;
} }
...@@ -109,7 +109,7 @@ THD::THD() ...@@ -109,7 +109,7 @@ THD::THD()
net.vio=0; net.vio=0;
ull=0; ull=0;
system_thread=0; system_thread=0;
bzero((char*) &alloc,sizeof(alloc)); bzero((char*) &mem_root,sizeof(mem_root));
#ifdef __WIN__ #ifdef __WIN__
real_id = 0 ; real_id = 0 ;
#endif #endif
...@@ -154,7 +154,7 @@ THD::~THD() ...@@ -154,7 +154,7 @@ THD::~THD()
safeFree(user); safeFree(user);
safeFree(db); safeFree(db);
safeFree(ip); safeFree(ip);
free_root(&alloc); free_root(&mem_root);
mysys_var=0; // Safety (shouldn't be needed) mysys_var=0; // Safety (shouldn't be needed)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -165,11 +165,10 @@ THD::~THD() ...@@ -165,11 +165,10 @@ THD::~THD()
bool THD::store_globals() bool THD::store_globals()
{ {
return (my_pthread_setspecific_ptr(THR_THD, this) || return (my_pthread_setspecific_ptr(THR_THD, this) ||
my_pthread_setspecific_ptr(THR_MALLOC, &alloc) || my_pthread_setspecific_ptr(THR_MALLOC, &mem_root) ||
my_pthread_setspecific_ptr(THR_NET, &net)); my_pthread_setspecific_ptr(THR_NET, &net));
} }
/***************************************************************************** /*****************************************************************************
** Functions to provide a interface to select results ** Functions to provide a interface to select results
*****************************************************************************/ *****************************************************************************/
......
...@@ -223,7 +223,7 @@ class THD :public ilink { ...@@ -223,7 +223,7 @@ class THD :public ilink {
public: public:
NET net; NET net;
LEX lex; LEX lex;
MEM_ROOT alloc; MEM_ROOT mem_root;
HASH user_vars; HASH user_vars;
String packet; /* Room for 1 row */ String packet; /* Room for 1 row */
struct sockaddr_in remote; struct sockaddr_in remote;
...@@ -287,6 +287,19 @@ public: ...@@ -287,6 +287,19 @@ public:
} }
return last_insert_id; return last_insert_id;
} }
inline bool active_transaction() { return transaction.bdb_tid != 0; }
inline gptr alloc(unsigned int size) { return alloc_root(&mem_root,size); }
inline gptr calloc(unsigned int size)
{
gptr ptr;
if ((ptr=alloc_root(&mem_root,size)))
bzero((char*) ptr,size);
return ptr;
}
inline char *strdup(const char *str)
{ return strdup_root(&mem_root,str); }
inline char *memdup(const char *str, unsigned int size)
{ return memdup_root(&mem_root,str,size); }
}; };
......
...@@ -1215,14 +1215,19 @@ void select_insert::send_error(uint errcode,const char *err) ...@@ -1215,14 +1215,19 @@ void select_insert::send_error(uint errcode,const char *err)
::send_error(&thd->net,errcode,err); ::send_error(&thd->net,errcode,err);
table->file->extra(HA_EXTRA_NO_CACHE); table->file->extra(HA_EXTRA_NO_CACHE);
table->file->activate_all_index(thd); table->file->activate_all_index(thd);
ha_rollback(thd);
} }
bool select_insert::send_eof() bool select_insert::send_eof()
{ {
int error; int error,error2;
if ((error=table->file->extra(HA_EXTRA_NO_CACHE)) || if (!(error=table->file->extra(HA_EXTRA_NO_CACHE)))
(error=table->file->activate_all_index(thd))) error=table->file->activate_all_index(thd);
if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error)
error=error2;
if (error)
{ {
table->file->print_error(error,MYF(0)); table->file->print_error(error,MYF(0));
::send_error(&thd->net); ::send_error(&thd->net);
......
...@@ -46,7 +46,8 @@ enum enum_sql_command { ...@@ -46,7 +46,8 @@ enum enum_sql_command {
SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_SHOW_GRANTS, SQLCOM_ANALYZE, SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_SHOW_GRANTS, SQLCOM_ANALYZE,
SQLCOM_ROLLBACK, SQLCOM_COMMIT, SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP, SQLCOM_ROLLBACK, SQLCOM_COMMIT, SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP,
SQLCOM_BEGIN, SQLCOM_LOAD_MASTER_TABLE, SQLCOM_SHOW_CREATE, SQLCOM_BEGIN, SQLCOM_LOAD_MASTER_TABLE, SQLCOM_SHOW_CREATE,
SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT, SQLCOM_CHANGE_MASTER SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT, SQLCOM_CHANGE_MASTER,
SQLCOM_RENAME_TABLE
}; };
enum lex_states { STATE_START, STATE_CHAR, STATE_IDENT, enum lex_states { STATE_START, STATE_CHAR, STATE_IDENT,
......
...@@ -773,9 +773,9 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds, ...@@ -773,9 +773,9 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
DBUG_ENTER("make_join_statistics"); DBUG_ENTER("make_join_statistics");
table_count=join->tables; table_count=join->tables;
stat=(JOIN_TAB*) sql_calloc(sizeof(JOIN_TAB)*table_count); stat=(JOIN_TAB*) join->thd->calloc(sizeof(JOIN_TAB)*table_count);
stat_ref=(JOIN_TAB**) sql_alloc(sizeof(JOIN_TAB*)*MAX_TABLES); stat_ref=(JOIN_TAB**) join->thd->alloc(sizeof(JOIN_TAB*)*MAX_TABLES);
table_vector=(TABLE**) sql_alloc(sizeof(TABLE**)*(table_count*2)); table_vector=(TABLE**) join->thd->alloc(sizeof(TABLE**)*(table_count*2));
if (!stat || !stat_ref || !table_vector) if (!stat || !stat_ref || !table_vector)
DBUG_RETURN(1); // Eom /* purecov: inspected */ DBUG_RETURN(1); // Eom /* purecov: inspected */
select=0; select=0;
...@@ -1832,7 +1832,7 @@ get_best_combination(JOIN *join) ...@@ -1832,7 +1832,7 @@ get_best_combination(JOIN *join)
table_count=join->tables; table_count=join->tables;
if (!(join->join_tab=join_tab= if (!(join->join_tab=join_tab=
(JOIN_TAB*) sql_alloc(sizeof(JOIN_TAB)*table_count))) (JOIN_TAB*) join->thd->alloc(sizeof(JOIN_TAB)*table_count)))
return TRUE; return TRUE;
join->const_tables=0; /* for checking */ join->const_tables=0; /* for checking */
...@@ -2056,8 +2056,8 @@ make_simple_join(JOIN *join,TABLE *tmp_table) ...@@ -2056,8 +2056,8 @@ make_simple_join(JOIN *join,TABLE *tmp_table)
TABLE **tableptr; TABLE **tableptr;
JOIN_TAB *join_tab; JOIN_TAB *join_tab;
if (!(tableptr=(TABLE**) sql_alloc(sizeof(TABLE*))) || if (!(tableptr=(TABLE**) join->thd->alloc(sizeof(TABLE*))) ||
!(join_tab=(JOIN_TAB*) sql_alloc(sizeof(JOIN_TAB)))) !(join_tab=(JOIN_TAB*) join->thd->alloc(sizeof(JOIN_TAB))))
return TRUE; return TRUE;
join->join_tab=join_tab; join->join_tab=join_tab;
join->table=tableptr; tableptr[0]=tmp_table; join->table=tableptr; tableptr[0]=tmp_table;
......
...@@ -55,7 +55,7 @@ mysqld_show_dbs(THD *thd,const char *wild) ...@@ -55,7 +55,7 @@ mysqld_show_dbs(THD *thd,const char *wild)
char *file_name; char *file_name;
DBUG_ENTER("mysqld_show_dbs"); DBUG_ENTER("mysqld_show_dbs");
field->name=(char*) sql_alloc(20+ (wild ? strlen(wild)+4: 0)); field->name=(char*) thd->alloc(20+ (wild ? strlen(wild)+4: 0));
field->max_length=NAME_LEN; field->max_length=NAME_LEN;
end=strmov(field->name,"Database"); end=strmov(field->name,"Database");
if (wild && wild[0]) if (wild && wild[0])
...@@ -92,7 +92,7 @@ int mysqld_show_tables(THD *thd,const char *db,const char *wild) ...@@ -92,7 +92,7 @@ int mysqld_show_tables(THD *thd,const char *db,const char *wild)
char *file_name; char *file_name;
DBUG_ENTER("mysqld_show_tables"); DBUG_ENTER("mysqld_show_tables");
field->name=(char*) sql_alloc(20+strlen(db)+(wild ? strlen(wild)+4:0)); field->name=(char*) thd->alloc(20+strlen(db)+(wild ? strlen(wild)+4:0));
end=strxmov(field->name,"Tables_in_",db,NullS); end=strxmov(field->name,"Tables_in_",db,NullS);
if (wild && wild[0]) if (wild && wild[0])
strxmov(end," (",wild,")",NullS); strxmov(end," (",wild,")",NullS);
...@@ -170,7 +170,7 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path, ...@@ -170,7 +170,7 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
if (check_grant(thd,TABLE_ACLS,&table_list,1)) if (check_grant(thd,TABLE_ACLS,&table_list,1))
continue; continue;
} }
if (files->push_back(sql_strdup(file->name))) if (files->push_back(thd->strdup(file->name)))
{ {
my_dirend(dirp); my_dirend(dirp);
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -868,12 +868,12 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) ...@@ -868,12 +868,12 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
thread_info *thd_info=new thread_info; thread_info *thd_info=new thread_info;
thd_info->thread_id=tmp->thread_id; thd_info->thread_id=tmp->thread_id;
thd_info->user=sql_strdup(tmp->user ? tmp->user : (tmp->system_thread ? thd_info->user=thd->strdup(tmp->user ? tmp->user : (tmp->system_thread ?
"system user" : "unauthenticated user")); "system user" : "unauthenticated user"));
thd_info->host=sql_strdup(tmp->host ? tmp->host : (tmp->ip ? tmp->ip : thd_info->host=thd->strdup(tmp->host ? tmp->host : (tmp->ip ? tmp->ip :
(tmp->system_thread ? "none" : "connecting host"))); (tmp->system_thread ? "none" : "connecting host")));
if ((thd_info->db=tmp->db)) // Safe test if ((thd_info->db=tmp->db)) // Safe test
thd_info->db=sql_strdup(thd_info->db); thd_info->db=thd->strdup(thd_info->db);
thd_info->command=(int) tmp->command; thd_info->command=(int) tmp->command;
if (tmp->mysys_var) if (tmp->mysys_var)
pthread_mutex_lock(&tmp->mysys_var->mutex); pthread_mutex_lock(&tmp->mysys_var->mutex);
...@@ -902,7 +902,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) ...@@ -902,7 +902,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
uint length=strlen(tmp->query); uint length=strlen(tmp->query);
if (length > max_query_length) if (length > max_query_length)
length=max_query_length; length=max_query_length;
thd_info->query=(char*) sql_memdup(tmp->query,length+1); thd_info->query=(char*) thd->memdup(tmp->query,length+1);
thd_info->query[length]=0; thd_info->query[length]=0;
} }
thread_infos.append(thd_info); thread_infos.append(thd_info);
......
...@@ -644,7 +644,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, ...@@ -644,7 +644,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
** Alter a table definition ** Alter a table definition
****************************************************************************/ ****************************************************************************/
static bool bool
mysql_rename_table(enum db_type base, mysql_rename_table(enum db_type base,
const char *old_db, const char *old_db,
const char * old_name, const char * old_name,
...@@ -659,9 +659,17 @@ mysql_rename_table(enum db_type base, ...@@ -659,9 +659,17 @@ mysql_rename_table(enum db_type base,
(void) sprintf(to,"%s/%s/%s",mysql_data_home,new_db,new_name); (void) sprintf(to,"%s/%s/%s",mysql_data_home,new_db,new_name);
fn_format(from,from,"","",4); fn_format(from,from,"","",4);
fn_format(to,to, "","",4); fn_format(to,to, "","",4);
if (file->rename_table((const char*) from,(const char *) to) || if (file->rename_table((const char*) from,(const char *) to))
rename_file_ext(from,to,reg_ext))
error=1; error=1;
else
{
if (rename_file_ext(from,to,reg_ext))
{
error=1;
/* Restore old file name */
file->rename_table((const char*) to,(const char *) from);
}
}
delete file; delete file;
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -1412,7 +1420,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1412,7 +1420,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
#ifdef __WIN__ #ifdef __WIN__
// Win32 can't rename an open table, so we must close the org table! // Win32 can't rename an open table, so we must close the org table!
table_name=sql_strdup(table_name); // must be saved table_name=thd->strdup(table_name); // must be saved
if (close_cached_table(thd,table)) if (close_cached_table(thd,table))
{ // Aborted { // Aborted
VOID(quick_rm_table(new_db_type,new_db,tmp_name)); VOID(quick_rm_table(new_db_type,new_db,tmp_name));
......
...@@ -488,7 +488,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -488,7 +488,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
query verb_clause create change select drop insert replace insert2 query verb_clause create change select drop insert replace insert2
insert_values update delete show describe load alter optimize flush insert_values update delete show describe load alter optimize flush
begin commit rollback slave master_def master_defs begin commit rollback slave master_def master_defs
repair analyze check field_list field_list_item field_spec kill repair analyze check rename
field_list field_list_item field_spec kill
select_item_list select_item values_list no_braces select_item_list select_item values_list no_braces
limit_clause delete_limit_clause fields opt_values values limit_clause delete_limit_clause fields opt_values values
procedure_list procedure_list2 procedure_item procedure_list procedure_list2 procedure_item
...@@ -504,6 +505,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -504,6 +505,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
flush_options flush_option insert_lock_option replace_lock_option flush_options flush_option insert_lock_option replace_lock_option
equal optional_braces opt_key_definition key_usage_list2 equal optional_braces opt_key_definition key_usage_list2
opt_mi_check_type opt_to mi_check_types normal_join opt_mi_check_type opt_to mi_check_types normal_join
table_to_table_list table_to_table
END_OF_INPUT END_OF_INPUT
%type <NONE> %type <NONE>
...@@ -539,6 +541,7 @@ verb_clause: ...@@ -539,6 +541,7 @@ verb_clause:
| lock | lock
| kill | kill
| optimize | optimize
| rename
| repair | repair
| replace | replace
| revoke | revoke
...@@ -1078,6 +1081,7 @@ opt_place: ...@@ -1078,6 +1081,7 @@ opt_place:
opt_to: opt_to:
/* empty */ {} /* empty */ {}
| TO_SYM {} | TO_SYM {}
| AS {}
slave: slave:
SLAVE START_SYM SLAVE START_SYM
...@@ -1134,6 +1138,24 @@ optimize: ...@@ -1134,6 +1138,24 @@ optimize:
YYABORT; YYABORT;
} }
rename:
RENAME table_or_tables
{
Lex->sql_command=SQLCOM_RENAME_TABLE;
}
table_to_table_list
table_to_table_list:
table_to_table
| table_to_table_list ',' table_to_table
table_to_table:
table_ident TO_SYM table_ident
{ if (add_table_to_list($1,NULL,TL_IGNORE) ||
add_table_to_list($3,NULL,TL_IGNORE))
YYABORT;
}
/* /*
** Select : retrieve data from table ** Select : retrieve data from table
*/ */
......
...@@ -23,6 +23,7 @@ extern "C" { ...@@ -23,6 +23,7 @@ extern "C" {
void sql_alloc_error_handler(void) void sql_alloc_error_handler(void)
{ {
current_thd->fatal_error=1; /* purecov: inspected */ current_thd->fatal_error=1; /* purecov: inspected */
sql_print_error(ER(ER_OUT_OF_RESOURCES));
} }
} }
...@@ -37,10 +38,6 @@ gptr sql_alloc(uint Size) ...@@ -37,10 +38,6 @@ gptr sql_alloc(uint Size)
{ {
MEM_ROOT *root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC); MEM_ROOT *root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
char *ptr= (char*) alloc_root(root,Size); char *ptr= (char*) alloc_root(root,Size);
if (!ptr)
{
sql_print_error(ER(ER_OUT_OF_RESOURCES));
}
return ptr; return ptr;
} }
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#define ERRMAPP 1 /* Errormap f|r my_error */ #define ERRMAPP 1 /* Errormap f|r my_error */
#define LIBLEN FN_REFLEN-FN_LEN /* Max l{ngd p} dev */ #define LIBLEN FN_REFLEN-FN_LEN /* Max l{ngd p} dev */
#define MAX_DBKEY_LENGTH (FN_LEN*2+2)
#define MAX_FIELD_NAME 34 /* Max colum name length +2 */ #define MAX_FIELD_NAME 34 /* Max colum name length +2 */
#define MAX_KEY 32 /* Max used keys */ #define MAX_KEY 32 /* Max used keys */
#define MAX_REF_PARTS 16 /* Max parts used as ref */ #define MAX_REF_PARTS 16 /* Max parts used as ref */
......
...@@ -224,7 +224,8 @@ int my_strnncoll_sjis(const uchar *s1, int len1, const uchar *s2, int len2) ...@@ -224,7 +224,8 @@ int my_strnncoll_sjis(const uchar *s1, int len1, const uchar *s2, int len2)
int my_strcoll_sjis(const uchar *s1, const uchar *s2) int my_strcoll_sjis(const uchar *s1, const uchar *s2)
{ {
return (uint) my_strnncoll_sjis(s1,(uint) strlen(s1), s2,(uint) strlen(s2)); return (uint) my_strnncoll_sjis(s1,(uint) strlen((char*) s1),
s2,(uint) strlen((char*) s2));
} }
int my_strnxfrm_sjis(uchar *dest, uchar *src, int len, int srclen) int my_strnxfrm_sjis(uchar *dest, uchar *src, int len, int srclen)
...@@ -245,7 +246,7 @@ int my_strnxfrm_sjis(uchar *dest, uchar *src, int len, int srclen) ...@@ -245,7 +246,7 @@ int my_strnxfrm_sjis(uchar *dest, uchar *src, int len, int srclen)
int my_strxfrm_sjis(uchar *dest, uchar *src, int len) int my_strxfrm_sjis(uchar *dest, uchar *src, int len)
{ {
return my_strnxfrm_sjis(dest, src, len, (uint) strlen(src)); return my_strnxfrm_sjis(dest, src, len, (uint) strlen((char*) src));
} }
......
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