Commit 21e7c668 authored by monty@donna.mysql.fi's avatar monty@donna.mysql.fi

Portability fixes for Ia64 and Sgi compiler

DROP DATABASE in mysqladmin asks for confirmation (again)
Added examined_rows to slow query log
SHOW CREATE for TEMPORARY table
parent 97c39276
...@@ -533,18 +533,18 @@ InnoDB Tables ...@@ -533,18 +533,18 @@ InnoDB Tables
* InnoDB overview:: InnoDB tables overview * InnoDB overview:: InnoDB tables overview
* InnoDB start:: InnoDB startup options * InnoDB start:: InnoDB startup options
* Creating an InnoDB database:: Creating an InnoDB database. Creating an InnoDB database * Creating an InnoDB database:: Creating an InnoDB database.
* Using InnoDB tables:: Creating InnoDB tables * Using InnoDB tables:: Creating InnoDB tables
* Adding and removing:: Adding and removing InnoDB data and log files * Adding and removing:: Adding and removing InnoDB data and log files
* Backing up:: Backing up and recovering an InnoDB database * Backing up:: Backing up and recovering an InnoDB database
* Moving:: Moving an InnoDB database to another machine * Moving:: Moving an InnoDB database to another machine
* InnoDB transaction model:: InnoDB transaction model. InnoDB transaction model * InnoDB transaction model:: InnoDB transaction model.
* Implementation:: Implementation of multiversioning * Implementation:: Implementation of multiversioning
* Table and index:: Table and index structures * Table and index:: Table and index structures
* File space management:: File space management and disk i/o * File space management:: File space management and disk i/o
* Error handling:: Error handling * Error handling:: Error handling
* InnoDB restrictions:: Some restrictions on InnoDB tables * InnoDB restrictions:: Some restrictions on InnoDB tables
* InnoDB contact information:: InnoDB contact information. InnoDB contact information * InnoDB contact information:: InnoDB contact information.
MySQL Tutorial MySQL Tutorial
...@@ -666,7 +666,7 @@ Speed of Queries that Access or Update Data ...@@ -666,7 +666,7 @@ Speed of Queries that Access or Update Data
MySQL Utilites MySQL Utilites
* Programs:: What do the executables do? * Programs:: What do the executables do?
* mysqld-max:: * mysqld-max:: mysqld-max, An extended mysqld server
* safe_mysqld:: safe_mysqld, the wrapper around mysqld * safe_mysqld:: safe_mysqld, the wrapper around mysqld
* mysqld_multi:: Program for managing multiple @strong{MySQL} servers * mysqld_multi:: Program for managing multiple @strong{MySQL} servers
* mysql:: The command line tool * mysql:: The command line tool
...@@ -759,6 +759,7 @@ Problems and Common Errors ...@@ -759,6 +759,7 @@ Problems and Common Errors
* No matching rows:: Solving problems with no matching rows * No matching rows:: Solving problems with no matching rows
* ALTER TABLE problems:: Problems with @code{ALTER TABLE}. * ALTER TABLE problems:: Problems with @code{ALTER TABLE}.
* Change column order:: How to change the order of columns in a table * Change column order:: How to change the order of columns in a table
* Temporary table problems::
Some Common Errors When Using MySQL Some Common Errors When Using MySQL
...@@ -926,7 +927,7 @@ Changes in release 4.0.x (Development; Alpha) ...@@ -926,7 +927,7 @@ Changes in release 4.0.x (Development; Alpha)
Changes in release 3.23.x (Stable) Changes in release 3.23.x (Stable)
* News-3.23.38:: * News-3.23.38:: Changes in release 3.23.38
* News-3.23.37:: Changes in release 3.23.37 * News-3.23.37:: Changes in release 3.23.37
* News-3.23.36:: Changes in release 3.23.36 * News-3.23.36:: Changes in release 3.23.36
* News-3.23.35:: Changes in release 3.23.35 * News-3.23.35:: Changes in release 3.23.35
...@@ -2442,7 +2443,7 @@ New Client libraries for the Mac OS Classic (Macintosh). ...@@ -2442,7 +2443,7 @@ New Client libraries for the Mac OS Classic (Macintosh).
@item @uref{http://www.lilback.com/macsql/} @item @uref{http://www.lilback.com/macsql/}
Client libraries for Mac OS Classic (Macintosh). Client libraries for Mac OS Classic (Macintosh).
@item @uref{http://mapage.noos.fr/vpenvern01/index_en.html} @item @uref{http://sixk.maniasys.com/index_en.html}
MySQL for Amiga MySQL for Amiga
@end table @end table
...@@ -3104,8 +3105,23 @@ unsubscribe from the @code{myodbc} list, send a message to ...@@ -3104,8 +3105,23 @@ unsubscribe from the @code{myodbc} list, send a message to
@email{myodbc-subscribe@@lists.mysql.com} or @email{myodbc-subscribe@@lists.mysql.com} or
@email{myodbc-unsubscribe@@lists.mysql.com}. @email{myodbc-unsubscribe@@lists.mysql.com}.
There is also a german mailing list. You can find information about this The following table shows some @strong{MySQL} mailing in other languages than
at: @uref{http://www.4t2.com/mysql}. English. Note that these are not operated by @strong{MySQL AB}, so we can't
guarantee the quality on these.
@table @code
@item @email{mysql-france-subscribe@@yahoogroups.com, A French mailing list}
@item @email{list@@tinc.net, A Korean mailing list}
Email @code{subscribe mysql your@@email.address} to this list.
@item @email{mysql-de-request@@lists.4t2.com, A German mailing list}
Email @code{subscribe mysql-de your@@email.address} to this list.
You can find information about this mailing list at
@uref{http://www.4t2.com/mysql}.
@item @email{mysql-br-request@@listas.linkway.com.br, A Portugese mailing list}
Email @code{subscribe mysql-br your@@email.address} to this list.
@item @email{mysql-alta@@elistas.net, A Spanish mailing list}
Email @code{subscribe mysql your@@email.address} to this list.
@end table
@cindex net etiquette @cindex net etiquette
@cindex mailing lists, archive location @cindex mailing lists, archive location
...@@ -8680,6 +8696,16 @@ The optimization flags used by @strong{MySQL} (-O3) are not recognized by HP's ...@@ -8680,6 +8696,16 @@ The optimization flags used by @strong{MySQL} (-O3) are not recognized by HP's
compilers. I did not change the flags. compilers. I did not change the flags.
@end itemize @end itemize
If you get the following error from @code{configure}
@example
checking for cc option to accept ANSI C... no
configure: error: MySQL requires a ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.
@end example
Check that you don't have the path to the K&R compiler before the path
to the HP-UX C and C++ compiler.
@node Mac OS X, BEOS, HP-UX 11.x, Source install system issues @node Mac OS X, BEOS, HP-UX 11.x, Source install system issues
@subsection Mac OS X Notes @subsection Mac OS X Notes
...@@ -18181,6 +18207,11 @@ per-connection basis. It will not be changed by another client. It will not ...@@ -18181,6 +18207,11 @@ per-connection basis. It will not be changed by another client. It will not
even be changed if you update another @code{AUTO_INCREMENT} column with a even be changed if you update another @code{AUTO_INCREMENT} column with a
non-magic value (that is, a value that is not @code{NULL} and not @code{0}). non-magic value (that is, a value that is not @code{NULL} and not @code{0}).
If you insert many rows at the same time with an insert statement,
@code{LAST_INSERT_ID()} returns the value for the first inserted row.
The reason for this is so that you it makes it possible to easily reproduce
the same @code{INSERT} statement against some other server.
@cindex sequence emulation @cindex sequence emulation
If @code{expr} is given as an argument to @code{LAST_INSERT_ID()} in an If @code{expr} is given as an argument to @code{LAST_INSERT_ID()} in an
@code{UPDATE} clause, then the value of the argument is returned as a @code{UPDATE} clause, then the value of the argument is returned as a
...@@ -24378,18 +24409,18 @@ NuSphere is working on removing these limitations. ...@@ -24378,18 +24409,18 @@ NuSphere is working on removing these limitations.
@menu @menu
* InnoDB overview:: InnoDB tables overview * InnoDB overview:: InnoDB tables overview
* InnoDB start:: InnoDB startup options * InnoDB start:: InnoDB startup options
* Creating an InnoDB database:: Creating an InnoDB database. Creating an InnoDB database * Creating an InnoDB database:: Creating an InnoDB database.
* Using InnoDB tables:: Creating InnoDB tables * Using InnoDB tables:: Creating InnoDB tables
* Adding and removing:: Adding and removing InnoDB data and log files * Adding and removing:: Adding and removing InnoDB data and log files
* Backing up:: Backing up and recovering an InnoDB database * Backing up:: Backing up and recovering an InnoDB database
* Moving:: Moving an InnoDB database to another machine * Moving:: Moving an InnoDB database to another machine
* InnoDB transaction model:: InnoDB transaction model. InnoDB transaction model * InnoDB transaction model:: InnoDB transaction model.
* Implementation:: Implementation of multiversioning * Implementation:: Implementation of multiversioning
* Table and index:: Table and index structures * Table and index:: Table and index structures
* File space management:: File space management and disk i/o * File space management:: File space management and disk i/o
* Error handling:: Error handling * Error handling:: Error handling
* InnoDB restrictions:: Some restrictions on InnoDB tables * InnoDB restrictions:: Some restrictions on InnoDB tables
* InnoDB contact information:: InnoDB contact information. InnoDB contact information * InnoDB contact information:: InnoDB contact information.
@end menu @end menu
@node InnoDB overview, InnoDB start, InnoDB, InnoDB @node InnoDB overview, InnoDB start, InnoDB, InnoDB
...@@ -24399,55 +24430,56 @@ InnoDB tables are included in the @strong{MySQL} source distribution ...@@ -24399,55 +24430,56 @@ InnoDB tables are included in the @strong{MySQL} source distribution
starting from 3.23.34a and are activated in the @strong{MySQL -max} starting from 3.23.34a and are activated in the @strong{MySQL -max}
binary. binary.
If you have downloaded a binary version of MySQL that includes If you have downloaded a binary version of @strong{MySQL} that includes
support for InnoDB, simply follow the instructions for support for InnoDB (mysqld-max), simply follow the instructions for
installing a binary version of MySQL. installing a binary version of @strong{MySQL}. @xref{Installing binary}.
See section 4.6 'Installing a MySQL Binary Distribution'. @xref{mysqld-max}.
To compile MySQL with InnoDB support, download MySQL-3.23.34a or newer To compile @strong{MySQL} with InnoDB support, download MySQL-3.23.37 or newer
and configure @code{MySQL} with the and configure @code{MySQL} with the @code{--with-innodb} option.
@code{--with-innobase} option. Starting from MySQL-3.23.37 the option @xref{Installing source}.
is @code{--with-innodb}. See section
4.7 'Installing a MySQL Source Distribution'.
@example @example
cd /path/to/source/of/mysql-3.23.37 cd /path/to/source/of/mysql-3.23.37
./configure --with-innodb ./configure --with-innodb
@end example @end example
InnoDB provides MySQL with a transaction safe table handler with InnoDB provides @strong{MySQL} with a transaction safe table handler with
commit, rollback, and crash recovery capabilities. InnoDB does commit, rollback, and crash recovery capabilities. InnoDB does
locking on row level, and also provides an Oracle-style consistent locking on row level, and also provides an Oracle-style consistent
non-locking read in @code{SELECTS}, which increases transaction non-locking read in @code{SELECTS}, which increases transaction
concurrency. There is not need for lock escalation in InnoDB, concurrency. There is not need for lock escalation in InnoDB,
because row level locks in InnoDB fit in very small space. because row level locks in InnoDB fit in very small space.
Technically, InnoDB is a database backend placed under MySQL. InnoDB Technically, InnoDB is a database backend placed under @strong{MySQL}. InnoDB
has its own buffer pool for caching data and indexes in main has its own buffer pool for caching data and indexes in main
memory. InnoDB stores its tables and indexes in a tablespace, which memory. InnoDB stores its tables and indexes in a tablespace, which
may consist of several files. This is different from, for example, may consist of several files. This is different from, for example,
@code{MyISAM} tables where each table is stored as a separate file. @code{MyISAM} tables where each table is stored as a separate file.
InnoDB is distributed under the GNU GPL License Version 2 (of June 1991). InnoDB is distributed under the GNU GPL License Version 2 (of June 1991).
In the source distribution of MySQL, InnoDB appears as a subdirectory. In the source distribution of @strong{MySQL}, InnoDB appears as a subdirectory.
@node InnoDB start, Creating an InnoDB database, InnoDB overview, InnoDB @node InnoDB start, Creating an InnoDB database, InnoDB overview, InnoDB
@subsection InnoDB startup options @subsection InnoDB startup options
Beginning from MySQL-3.23.37 the prefix of the options is changed Beginning from @strong{MySQL}-3.23.37 the prefix of the options is changed
from @code{innobase_...} to @code{innodb_...}. from @code{innobase_...} to @code{innodb_...}.
To use InnoDB tables you must specify configuration parameters To use InnoDB tables you @strong{MUST} specify configuration parameters
in the MySQL configuration file in the @code{[mysqld]} section of in the @strong{MySQL} configuration file in the @code{[mysqld]} section of
the configuration file @file{my.cnf}. the configuration file @file{my.cnf}. @xref{Option files}.
Suppose you have a Windows NT machine with 128 MB RAM and a
single 10 GB hard disk. The only required parameter to use InnoDB is @code{innodb_data_file_path},
Below is an example of possible configuration parameters in @file{my.cnf} for but you should set others if you want to get a better performance.
InnoDB:
Suppose you have a Windows NT machine with 128 MB RAM and a single 10 GB
hard disk. Below is an example of possible configuration parameters in
@file{my.cnf} for InnoDB:
@example @example
innodb_data_home_dir = c:\ibdata
innodb_data_file_path = ibdata1:2000M;ibdata2:2000M innodb_data_file_path = ibdata1:2000M;ibdata2:2000M
innodb_data_home_dir = c:\ibdata
set-variable = innodb_mirrored_log_groups=1 set-variable = innodb_mirrored_log_groups=1
innodb_log_group_home_dir = c:\iblogs innodb_log_group_home_dir = c:\iblogs
set-variable = innodb_log_files_in_group=3 set-variable = innodb_log_files_in_group=3
...@@ -24469,8 +24501,8 @@ Below is an example of possible configuration parameters in @file{my.cnf} for ...@@ -24469,8 +24501,8 @@ Below is an example of possible configuration parameters in @file{my.cnf} for
InnoDB: InnoDB:
@example @example
innodb_data_home_dir = /
innodb_data_file_path = ibdata/ibdata1:2000M;dr2/ibdata/ibdata2:2000M innodb_data_file_path = ibdata/ibdata1:2000M;dr2/ibdata/ibdata2:2000M
innodb_data_home_dir = /
set-variable = innodb_mirrored_log_groups=1 set-variable = innodb_mirrored_log_groups=1
innodb_log_group_home_dir = /dr3 innodb_log_group_home_dir = /dr3
set-variable = innodb_log_files_in_group=3 set-variable = innodb_log_files_in_group=3
...@@ -24540,7 +24572,7 @@ log archiving. The value of this parameter should currently be set the ...@@ -24540,7 +24572,7 @@ log archiving. The value of this parameter should currently be set the
same as @code{innodb_log_group_home_dir}. same as @code{innodb_log_group_home_dir}.
@item @code{innodb_log_archive} @tab @item @code{innodb_log_archive} @tab
This value should currently be set to 0. As recovery from a backup is This value should currently be set to 0. As recovery from a backup is
done by MySQL using its own log files, there is currently no need to done by @strong{MySQL} using its own log files, there is currently no need to
archive InnoDB log files. archive InnoDB log files.
@item @code{innodb_buffer_pool_size} @tab @item @code{innodb_buffer_pool_size} @tab
The size of the memory buffer InnoDB uses to cache data and indexes of The size of the memory buffer InnoDB uses to cache data and indexes of
...@@ -24555,7 +24587,7 @@ and other internal data structures. A sensible value for this might be ...@@ -24555,7 +24587,7 @@ and other internal data structures. A sensible value for this might be
2M, but the more tables you have in your application the more you will 2M, but the more tables you have in your application the more you will
need to allocate here. If InnoDB runs out of memory in this pool, it need to allocate here. If InnoDB runs out of memory in this pool, it
will start to allocate memory from the operating system, and write will start to allocate memory from the operating system, and write
warning messages to the MySQL error log. warning messages to the @strong{MySQL} error log.
@item @code{innodb_file_io_threads} @tab @item @code{innodb_file_io_threads} @tab
Number of file i/o threads in InnoDB. Normally, this should be 4, but Number of file i/o threads in InnoDB. Normally, this should be 4, but
on Windows NT disk i/o may benefit from a larger number. on Windows NT disk i/o may benefit from a larger number.
...@@ -24572,15 +24604,15 @@ resolve the situation. ...@@ -24572,15 +24604,15 @@ resolve the situation.
@node Creating an InnoDB database, Using InnoDB tables, InnoDB start, InnoDB @node Creating an InnoDB database, Using InnoDB tables, InnoDB start, InnoDB
@subsection Creating an InnoDB database @subsection Creating an InnoDB database
Suppose you have installed MySQL and have edited @file{my.cnf} so that Suppose you have installed @strong{MySQL} and have edited @file{my.cnf} so that
it contains the necessary InnoDB configuration parameters. it contains the necessary InnoDB configuration parameters.
Before starting MySQL you should check that the directories you have Before starting @strong{MySQL} you should check that the directories you have
specified for InnoDB data files and log files exist and that you have specified for InnoDB data files and log files exist and that you have
access rights to those directories. InnoDB access rights to those directories. InnoDB
cannot create directories, only files. Check also you have enough disk space cannot create directories, only files. Check also you have enough disk space
for the data and log files. for the data and log files.
When you now start MySQL, InnoDB will start creating your data files When you now start @strong{MySQL}, InnoDB will start creating your data files
and log files. InnoDB will print something like the following: and log files. InnoDB will print something like the following:
@example @example
...@@ -24605,9 +24637,9 @@ InnoDB: Started ...@@ -24605,9 +24637,9 @@ InnoDB: Started
mysqld: ready for connections mysqld: ready for connections
@end example @end example
A new InnoDB database has now been created. You can connect to the MySQL A new InnoDB database has now been created. You can connect to the @strong{MySQL}
server with the usual MySQL client programs like @code{mysql}. server with the usual @strong{MySQL} client programs like @code{mysql}.
When you shut down the MySQL server with @file{mysqladmin shutdown}, When you shut down the @strong{MySQL} server with @file{mysqladmin shutdown},
InnoDB output will be like the following: InnoDB output will be like the following:
@example @example
...@@ -24622,7 +24654,7 @@ will see the files created. The log directory will also contain ...@@ -24622,7 +24654,7 @@ will see the files created. The log directory will also contain
a small file named @file{ib_arch_log_0000000000}. That file a small file named @file{ib_arch_log_0000000000}. That file
resulted from the database creation, after which InnoDB switched off resulted from the database creation, after which InnoDB switched off
log archiving. log archiving.
When MySQL is again started, the output will be like the following: When @strong{MySQL} is again started, the output will be like the following:
@example @example
~/mysqlm/sql > mysqld ~/mysqlm/sql > mysqld
...@@ -24632,17 +24664,17 @@ mysqld: ready for connections ...@@ -24632,17 +24664,17 @@ mysqld: ready for connections
@subsubsection If something goes wrong in database creation @subsubsection If something goes wrong in database creation
If something goes wrong in an InnoDB database creation, you should delete If something goes wrong in an InnoDB database creation, you should
all files created by InnoDB. This means all data files, all log files, delete all files created by InnoDB. This means all data files, all log
the small archived log file, and in the case you already did create files, the small archived log file, and in the case you already did
some InnoDB tables, delete also the corresponding @file{.frm} create some InnoDB tables, delete also the corresponding @file{.frm}
files for these tables from the MySQL database directories. Then you can files for these tables from the @strong{MySQL} database
try the InnoDB database creation again. directories. Then you can try the InnoDB database creation again.
@node Using InnoDB tables, Adding and removing, Creating an InnoDB database, InnoDB @node Using InnoDB tables, Adding and removing, Creating an InnoDB database, InnoDB
@subsection Creating InnoDB tables @subsection Creating InnoDB tables
Suppose you have started the MySQL client with the command Suppose you have started the @strong{MySQL} client with the command
@code{mysql test}. @code{mysql test}.
To create a table in the InnoDB format you must specify To create a table in the InnoDB format you must specify
@code{TYPE = InnoDB} in the table creation SQL command: @code{TYPE = InnoDB} in the table creation SQL command:
...@@ -24653,15 +24685,15 @@ CREATE TABLE CUSTOMER (A INT, B CHAR (20), INDEX (A)) TYPE = InnoDB; ...@@ -24653,15 +24685,15 @@ CREATE TABLE CUSTOMER (A INT, B CHAR (20), INDEX (A)) TYPE = InnoDB;
This SQL command will create a table and an index on column @code{A} This SQL command will create a table and an index on column @code{A}
into the InnoDB tablespace consisting of the data files you specified into the InnoDB tablespace consisting of the data files you specified
in @file{my.cnf}. In addition MySQL will create a file in @file{my.cnf}. In addition @strong{MySQL} will create a file
@file{CUSTOMER.frm} to the MySQL database directory @file{test}. @file{CUSTOMER.frm} to the @strong{MySQL} database directory @file{test}.
Internally, InnoDB will add to its own data dictionary an entry Internally, InnoDB will add to its own data dictionary an entry
for table @code{'test/CUSTOMER'}. Thus you can create a table for table @code{'test/CUSTOMER'}. Thus you can create a table
of the same name @code{CUSTOMER} in another database of MySQL, and of the same name @code{CUSTOMER} in another database of @strong{MySQL}, and
the table names will not collide inside InnoDB. the table names will not collide inside InnoDB.
You can query the amount of free space in the InnoDB tablespace You can query the amount of free space in the InnoDB tablespace
by issuing the table status command of MySQL for any table you have by issuing the table status command of @strong{MySQL} for any table you have
created with @code{TYPE = InnoDB}. Then the amount of free created with @code{TYPE = InnoDB}. Then the amount of free
space in the tablespace appears in the table comment section in the space in the tablespace appears in the table comment section in the
output of @code{SHOW}. An example: output of @code{SHOW}. An example:
...@@ -24679,7 +24711,7 @@ You must drop the tables individually. Also take care not to delete or ...@@ -24679,7 +24711,7 @@ You must drop the tables individually. Also take care not to delete or
add @file{.frm} files to your InnoDB database manually: use add @file{.frm} files to your InnoDB database manually: use
@code{CREATE TABLE} and @code{DROP TABLE} commands. @code{CREATE TABLE} and @code{DROP TABLE} commands.
InnoDB has its own internal data dictionary, and you will get problems InnoDB has its own internal data dictionary, and you will get problems
if the MySQL @file{.frm} files are out of 'sync' with the InnoDB if the @strong{MySQL} @file{.frm} files are out of 'sync' with the InnoDB
internal data dictionary. internal data dictionary.
@node Adding and removing, Backing up, Using InnoDB tables, InnoDB @node Adding and removing, Backing up, Using InnoDB tables, InnoDB
...@@ -24687,8 +24719,8 @@ internal data dictionary. ...@@ -24687,8 +24719,8 @@ internal data dictionary.
You cannot increase the size of an InnoDB data file. To add more into You cannot increase the size of an InnoDB data file. To add more into
your tablespace you have to add a new data file. To do this you have to your tablespace you have to add a new data file. To do this you have to
shut down your MySQL database, edit the @file{my.cnf} file, adding a shut down your @strong{MySQL} database, edit the @file{my.cnf} file, adding a
new file to @code{innodb_data_file_path}, and then start MySQL new file to @code{innodb_data_file_path}, and then start @strong{MySQL}
again. again.
Currently you cannot remove a data file from InnoDB. To decrease the Currently you cannot remove a data file from InnoDB. To decrease the
...@@ -24697,11 +24729,11 @@ all your tables, create a new database, and import your tables to the ...@@ -24697,11 +24729,11 @@ all your tables, create a new database, and import your tables to the
new database. new database.
If you want to change the number or the size of your InnoDB log files, If you want to change the number or the size of your InnoDB log files,
you have to shut down MySQL and make sure that it shuts down without errors. you have to shut down @strong{MySQL} and make sure that it shuts down without errors.
Then copy the old log files into a safe place just in case something Then copy the old log files into a safe place just in case something
went wrong in the shutdown and you will need them to recover the went wrong in the shutdown and you will need them to recover the
database. Delete then the old log files from the log file directory, database. Delete then the old log files from the log file directory,
edit @file{my.cnf}, and start MySQL again. InnoDB will tell edit @file{my.cnf}, and start @strong{MySQL} again. InnoDB will tell
you at the startup that it is creating new log files. you at the startup that it is creating new log files.
@node Backing up, Moving, Adding and removing, InnoDB @node Backing up, Moving, Adding and removing, InnoDB
...@@ -24712,7 +24744,7 @@ To take a 'binary' backup of your database you have to do the following: ...@@ -24712,7 +24744,7 @@ To take a 'binary' backup of your database you have to do the following:
@itemize @bullet @itemize @bullet
@item @item
Shut down your MySQL database and make sure it shuts down without errors. Shut down your @strong{MySQL} database and make sure it shuts down without errors.
@item @item
Copy all your data files into a safe place. Copy all your data files into a safe place.
@item @item
...@@ -24743,12 +24775,12 @@ dumps. Then you can take the binary backup, and you will then have ...@@ -24743,12 +24775,12 @@ dumps. Then you can take the binary backup, and you will then have
a consistent snapshot of your database in two formats. a consistent snapshot of your database in two formats.
To be able to recover your InnoDB database to the present from the To be able to recover your InnoDB database to the present from the
binary backup described above, you have to run your MySQL database binary backup described above, you have to run your @strong{MySQL} database
with the general logging and log archiving of MySQL switched on. Here with the general logging and log archiving of @strong{MySQL} switched on. Here
by the general logging we mean the logging mechanism of the MySQL server by the general logging we mean the logging mechanism of the @strong{MySQL} server
which is independent of InnoDB logs. which is independent of InnoDB logs.
To recover from a crash of your MySQL server process, the only thing To recover from a crash of your @strong{MySQL} server process, the only thing
you have to do is to restart it. InnoDB will automatically check the you have to do is to restart it. InnoDB will automatically check the
logs and perform a roll-forward of the database to the present. logs and perform a roll-forward of the database to the present.
InnoDB will automatically roll back uncommitted transactions which were InnoDB will automatically roll back uncommitted transactions which were
...@@ -24783,7 +24815,7 @@ mysqld: ready for connections ...@@ -24783,7 +24815,7 @@ mysqld: ready for connections
If your database gets corrupted or your disk fails, you have If your database gets corrupted or your disk fails, you have
to do the recovery from a backup. In the case of corruption, you should to do the recovery from a backup. In the case of corruption, you should
first find a backup which is not corrupted. From a backup do the recovery first find a backup which is not corrupted. From a backup do the recovery
from the general log files of MySQL according to instructions in the from the general log files of @strong{MySQL} according to instructions in the
MySQL manual. MySQL manual.
@subsubsection Checkpoints @subsubsection Checkpoints
...@@ -24849,7 +24881,7 @@ to lock every row in the database, or any random subset of the rows, ...@@ -24849,7 +24881,7 @@ to lock every row in the database, or any random subset of the rows,
without InnoDB running out of memory. without InnoDB running out of memory.
In InnoDB all user activity happens inside transactions. If the In InnoDB all user activity happens inside transactions. If the
auto commit mode is used in MySQL, then each SQL statement auto commit mode is used in @strong{MySQL}, then each SQL statement
will form a single transaction. If the auto commit mode is will form a single transaction. If the auto commit mode is
switched off, then we can think that a user always has a transaction switched off, then we can think that a user always has a transaction
open. If he issues open. If he issues
...@@ -25017,7 +25049,7 @@ on the duplicate index record. ...@@ -25017,7 +25049,7 @@ on the duplicate index record.
@code{INSERT INTO T SELECT ... FROM S WHERE ...} sets an exclusive @code{INSERT INTO T SELECT ... FROM S WHERE ...} sets an exclusive
(non-next-key) lock on each row inserted into @code{T}. Does (non-next-key) lock on each row inserted into @code{T}. Does
the search on @code{S} as a consistent read, but sets shared next-key the search on @code{S} as a consistent read, but sets shared next-key
locks on @code{S} if the MySQL logging is on. InnoDB has to set locks on @code{S} if the @strong{MySQL} logging is on. InnoDB has to set
locks in the latter case because in roll-forward recovery from a locks in the latter case because in roll-forward recovery from a
backup every SQL statement has to be executed in exactly the same backup every SQL statement has to be executed in exactly the same
way as it was done originally. way as it was done originally.
...@@ -25037,10 +25069,10 @@ lock on every record the search encounters. ...@@ -25037,10 +25069,10 @@ lock on every record the search encounters.
lock on every record the search encounters. lock on every record the search encounters.
@item @item
@code{LOCK TABLES ... } : sets table locks. In the implementation @code{LOCK TABLES ... } : sets table locks. In the implementation
the MySQL layer of code sets these locks. The automatic deadlock detection the @strong{MySQL} layer of code sets these locks. The automatic deadlock detection
of InnoDB cannot detect deadlocks where such table locks are involved: of InnoDB cannot detect deadlocks where such table locks are involved:
see the next section below. See also section 13 'InnoDB restrictions' see the next section below. See also section 13 'InnoDB restrictions'
about the following: since MySQL does know about row level locks, about the following: since @strong{MySQL} does know about row level locks,
it is possible that you it is possible that you
get a table lock on a table where another user currently has row level get a table lock on a table where another user currently has row level
locks. But that does not put transaction integerity into danger. locks. But that does not put transaction integerity into danger.
...@@ -25051,7 +25083,7 @@ locks. But that does not put transaction integerity into danger. ...@@ -25051,7 +25083,7 @@ locks. But that does not put transaction integerity into danger.
InnoDB automatically detects a deadlock of transactions and rolls InnoDB automatically detects a deadlock of transactions and rolls
back the transaction whose lock request was the last one to build back the transaction whose lock request was the last one to build
a deadlock, that is, a cycle in the waits-for graph of transactions. a deadlock, that is, a cycle in the waits-for graph of transactions.
InnoDB cannot detect deadlocks where a lock set by a MySQL InnoDB cannot detect deadlocks where a lock set by a @strong{MySQL}
@code{LOCK TABLES} statement is involved, or if a lock set @code{LOCK TABLES} statement is involved, or if a lock set
in another table handler than InnoDB is involved. You have to resolve in another table handler than InnoDB is involved. You have to resolve
these situations using @code{innodb_lock_wait_timeout} set in these situations using @code{innodb_lock_wait_timeout} set in
...@@ -25318,7 +25350,7 @@ The following list specifies the error handling of InnoDB. ...@@ -25318,7 +25350,7 @@ The following list specifies the error handling of InnoDB.
@itemize @bullet @itemize @bullet
@item @item
If you run out of file space in the tablespace, If you run out of file space in the tablespace,
you will get the MySQL @code{'Table is full'} error you will get the @strong{MySQL} @code{'Table is full'} error
and InnoDB rolls back the SQL statement. and InnoDB rolls back the SQL statement.
@item @item
A transaction deadlock or a timeout in a lock wait will give A transaction deadlock or a timeout in a lock wait will give
...@@ -25333,7 +25365,7 @@ statement. ...@@ -25333,7 +25365,7 @@ statement.
@item @item
A 'row too long' error rolls back the SQL statement. A 'row too long' error rolls back the SQL statement.
@item @item
Other errors are mostly detected by the MySQL layer of code, and Other errors are mostly detected by the @strong{MySQL} layer of code, and
they roll back the corresponding SQL statement. they roll back the corresponding SQL statement.
@end itemize @end itemize
...@@ -25353,7 +25385,7 @@ where only the first 5 characters from column @code{A} are stored. ...@@ -25353,7 +25385,7 @@ where only the first 5 characters from column @code{A} are stored.
@item @item
@code{INSERT DELAYED} is not supported for InnoDB tables. @code{INSERT DELAYED} is not supported for InnoDB tables.
@item @item
The MySQL @code{LOCK TABLES} operation does not know of InnoDB The @strong{MySQL} @code{LOCK TABLES} operation does not know of InnoDB
row level locks set in already completed SQL statements: this means that row level locks set in already completed SQL statements: this means that
you can get a table lock on a table even if there still exist transactions you can get a table lock on a table even if there still exist transactions
of other users which have row level locks on the same table. Thus of other users which have row level locks on the same table. Thus
...@@ -25370,7 +25402,7 @@ A table cannot contain more than 1000 columns. ...@@ -25370,7 +25402,7 @@ A table cannot contain more than 1000 columns.
@item @item
@code{DELETE FROM TABLE} does not regenerate the table but instead @code{DELETE FROM TABLE} does not regenerate the table but instead
deletes all rows, one by one, which is not that fast. In future versions deletes all rows, one by one, which is not that fast. In future versions
of MySQL you can use @code{TRUNCATE} which is fast. of @strong{MySQL} you can use @code{TRUNCATE} which is fast.
@item @item
Before dropping a database with InnoDB tables one has to drop Before dropping a database with InnoDB tables one has to drop
the individual InnoDB tables first. the individual InnoDB tables first.
...@@ -31451,7 +31483,7 @@ We can find the result from crash-me on a lot of different databases at ...@@ -31451,7 +31483,7 @@ We can find the result from crash-me on a lot of different databases at
@menu @menu
* Programs:: What do the executables do? * Programs:: What do the executables do?
* mysqld-max:: * mysqld-max:: mysqld-max, An extended mysqld server
* safe_mysqld:: safe_mysqld, the wrapper around mysqld * safe_mysqld:: safe_mysqld, the wrapper around mysqld
* mysqld_multi:: Program for managing multiple @strong{MySQL} servers * mysqld_multi:: Program for managing multiple @strong{MySQL} servers
* mysql:: The command line tool * mysql:: The command line tool
...@@ -31636,6 +31668,13 @@ The meaning of the values are: ...@@ -31636,6 +31668,13 @@ The meaning of the values are:
@item DISABLED @tab The xxxx option is disabled because one started @code{mysqld} with @code{--skip-xxxx} or because one didn't start @code{mysqld} with all needed options to enable the option. In this case the @code{hostname.err} file should contain a reason for why the option is disabled. @item DISABLED @tab The xxxx option is disabled because one started @code{mysqld} with @code{--skip-xxxx} or because one didn't start @code{mysqld} with all needed options to enable the option. In this case the @code{hostname.err} file should contain a reason for why the option is disabled.
@end multitable @end multitable
@strong{NOTE}: To be able to create InnoDB tables you @strong{MUST} edit
your startup options to include at least the @code{innodb_data_file_path}
option. @xref{InnoDB start}.
To get better performance for BDB tables, you should add some configuration
options for these too. @xref{BDB start}.
@code{safe_mysqld} will automaticly try to start any @code{mysqld} binary @code{safe_mysqld} will automaticly try to start any @code{mysqld} binary
with the @code{-max} prefix. This makes it very easy to test out a with the @code{-max} prefix. This makes it very easy to test out a
another @code{mysqld} binary in an existing installation. Just another @code{mysqld} binary in an existing installation. Just
...@@ -31657,6 +31696,7 @@ binaries includes: ...@@ -31657,6 +31696,7 @@ binaries includes:
@item HPUX 11.0 @tab N @tab Y @item HPUX 11.0 @tab N @tab Y
@item Linux-Alpha @tab N @tab Y @item Linux-Alpha @tab N @tab Y
@item Linux-Intel @tab Y @tab Y @item Linux-Intel @tab Y @tab Y
@item Linux-Ia64 @tab N @tab Y
@item Solaris-intel @tab N @tab Y @item Solaris-intel @tab N @tab Y
@item Solaris-sparc @tab Y @tab Y @item Solaris-sparc @tab Y @tab Y
@item SCO OSR5 @tab Y @tab Y @item SCO OSR5 @tab Y @tab Y
...@@ -35602,6 +35642,8 @@ INSERT INTO foo (auto,text) VALUES(NULL,'text'); ...@@ -35602,6 +35642,8 @@ INSERT INTO foo (auto,text) VALUES(NULL,'text');
INSERT INTO foo2 (id,text) VALUES(LAST_INSERT_ID(),'text'); INSERT INTO foo2 (id,text) VALUES(LAST_INSERT_ID(),'text');
@end example @end example
@xref{Getting unique ID}.
For the benefit of some ODBC applications (at least Delphi and Access), For the benefit of some ODBC applications (at least Delphi and Access),
the following query can be used to find a newly inserted row: the following query can be used to find a newly inserted row:
@example @example
...@@ -35762,6 +35804,7 @@ pre-allocated MYSQL struct. ...@@ -35762,6 +35804,7 @@ pre-allocated MYSQL struct.
* No matching rows:: Solving problems with no matching rows * No matching rows:: Solving problems with no matching rows
* ALTER TABLE problems:: Problems with @code{ALTER TABLE}. * ALTER TABLE problems:: Problems with @code{ALTER TABLE}.
* Change column order:: How to change the order of columns in a table * Change column order:: How to change the order of columns in a table
* Temporary table problems::
@end menu @end menu
This chapter lists some common problems and error messages that users have This chapter lists some common problems and error messages that users have
...@@ -37308,7 +37351,7 @@ simple rename should get your data back. ...@@ -37308,7 +37351,7 @@ simple rename should get your data back.
@cindex columns, changing @cindex columns, changing
@cindex changing, column order @cindex changing, column order
@cindex tables, changing column order @cindex tables, changing column order
@node Change column order, , ALTER TABLE problems, Problems @node Change column order, Temporary table problems, ALTER TABLE problems, Problems
@section How To Change the Order of Columns in a Table @section How To Change the Order of Columns in a Table
The whole point of SQL is to abstract the application from the data The whole point of SQL is to abstract the application from the data
...@@ -37347,6 +37390,32 @@ Drop or rename @code{old_table}. ...@@ -37347,6 +37390,32 @@ Drop or rename @code{old_table}.
@code{ALTER TABLE new_table RENAME old_table}. @code{ALTER TABLE new_table RENAME old_table}.
@end enumerate @end enumerate
@cindex temporary tables, problems
@node Temporary table problems, , Change column order, Problems
@section TEMPORARY TABLE problems
The following are a list of the limitations with @code{TEMPORARY TABLES}.
@itemize @bullet
@item
A temporary table can only be of type @code{HEAP}, @code{ISAM} or
@code{MyISAM}.
@item
You can't use temporary tables more than once in the same query.
For example, the following doesn't work.
@example
select * from temporary_table, temporary_table as t2;
@end example
We plan to fix the above in 4.0.
@item
You can't use @code{RENAME} on a @code{TEMPORARY} table.
Note that @code{ALTER TABLE org_name RENAME new_name} works!
We plan to fix the above in 4.0.
@end itemize
@cindex problems, solving @cindex problems, solving
@cindex solving, problems @cindex solving, problems
@cindex databases, replicating @cindex databases, replicating
...@@ -43972,6 +44041,10 @@ not yet 100% confident in this code. ...@@ -43972,6 +44041,10 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.38 @appendixsubsec Changes in release 3.23.38
@itemize @bullet @itemize @bullet
@item @item
@code{SHOW CREATE TABLE} now returns @code{TEMPORARY} for temporary tables.
@item
Added @code{Rows_examined} to slow query log.
@item
Fixed problems with function returning empty string when using Fixed problems with function returning empty string when using
together with a group functions and a @code{WHERE} that didn't match any rows. together with a group functions and a @code{WHERE} that didn't match any rows.
@item @item
...@@ -49018,11 +49091,15 @@ mysql> UPDATE tbl_name SET KEY=KEY+1,KEY=KEY+1; ...@@ -49018,11 +49091,15 @@ mysql> UPDATE tbl_name SET KEY=KEY+1,KEY=KEY+1;
will update @code{KEY} with @code{2} instead of with @code{1}. will update @code{KEY} with @code{2} instead of with @code{1}.
@item @item
You can't use temporary tables more than once in the same query. You can't use temporary tables more than once in the same query.
For example, the following doesn't work.
@example @example
select * from temporary_table, temporary_table as t2; select * from temporary_table, temporary_table as t2;
@end example @end example
@item
@code{RENAME} doesn't work with @code{TEMPORARY} tables.
@item @item
The optimizer may handle @code{DISTINCT} differently if you are using The optimizer may handle @code{DISTINCT} differently if you are using
'hidden' columns in a join or not. In a join, hidden columns are 'hidden' columns in a join or not. In a join, hidden columns are
...@@ -199,7 +199,7 @@ fi ...@@ -199,7 +199,7 @@ fi
AC_DEFUN(MYSQL_PTHREAD_YIELD, AC_DEFUN(MYSQL_PTHREAD_YIELD,
[AC_CACHE_CHECK([if pthread_yield takes zero arguments], ac_cv_pthread_yield_zero_arg, [AC_CACHE_CHECK([if pthread_yield takes zero arguments], ac_cv_pthread_yield_zero_arg,
[AC_TRY_COMPILE([#define _GNU_SOURCE [AC_TRY_LINK([#define _GNU_SOURCE
#include <pthread.h> #include <pthread.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
...@@ -214,7 +214,7 @@ then ...@@ -214,7 +214,7 @@ then
fi fi
] ]
[AC_CACHE_CHECK([if pthread_yield takes 1 argument], ac_cv_pthread_yield_one_arg, [AC_CACHE_CHECK([if pthread_yield takes 1 argument], ac_cv_pthread_yield_one_arg,
[AC_TRY_COMPILE([#define _GNU_SOURCE [AC_TRY_LINK([#define _GNU_SOURCE
#include <pthread.h> #include <pthread.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
...@@ -550,7 +550,8 @@ AC_DEFUN(MYSQL_STACK_DIRECTION, ...@@ -550,7 +550,8 @@ AC_DEFUN(MYSQL_STACK_DIRECTION,
AC_DEFUN(MYSQL_FUNC_ALLOCA, AC_DEFUN(MYSQL_FUNC_ALLOCA,
[ [
# Since we have heard that alloca fails on IRIX never define it on a SGI machine # Since we have heard that alloca fails on IRIX never define it on a
# SGI machine
if test ! "$host_vendor" = "sgi" if test ! "$host_vendor" = "sgi"
then then
AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally. AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.
......
...@@ -36,14 +36,16 @@ const char *client_errors[]= ...@@ -36,14 +36,16 @@ const char *client_errors[]=
"MySQL client got out of memory", "MySQL client got out of memory",
"Wrong host info", "Wrong host info",
"Localhost via UNIX socket", "Localhost via UNIX socket",
"%s via TCP/IP", "%-.64s via TCP/IP",
"Error in server handshake", "Error in server handshake",
"Lost connection to MySQL server during query", "Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now", "Commands out of sync; You can't run this command now",
"Verbindung ueber Named Pipe; Host: %-.64s", "Verbindung ueber Named Pipe; Host: %-.64s",
"Kann nicht auf Named Pipe warten. Host: %-.64s pipe: %-.32s (%lu)", "Kann nicht auf Named Pipe warten. Host: %-.64s pipe: %-.32s (%lu)",
"Kann Named Pipe nicht oeffnen. Host: %-.64s pipe: %-.32s (%lu)", "Kann Named Pipe nicht oeffnen. Host: %-.64s pipe: %-.32s (%lu)",
"Kann den Status der Named Pipe nicht setzen. Host: %-.64s pipe: %-.32s (%lu)" "Kann den Status der Named Pipe nicht setzen. Host: %-.64s pipe: %-.32s (%lu)",
"Can't initialize character set %-.64s (path: %-.64s)",
"Got packet bigger than 'max_allowed_packet'"
}; };
#else /* ENGLISH */ #else /* ENGLISH */
...@@ -60,19 +62,21 @@ const char *client_errors[]= ...@@ -60,19 +62,21 @@ const char *client_errors[]=
"MySQL client run out of memory", "MySQL client run out of memory",
"Wrong host info", "Wrong host info",
"Localhost via UNIX socket", "Localhost via UNIX socket",
"%s via TCP/IP", "%-.64s via TCP/IP",
"Error in server handshake", "Error in server handshake",
"Lost connection to MySQL server during query", "Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now", "Commands out of sync; You can't run this command now",
"%s via named pipe", "%-.64s via named pipe",
"Can't wait for named pipe to host: %-.64s pipe: %-.32s (%lu)", "Can't wait for named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't open named pipe to host: %-.64s pipe: %-.32s (%lu)", "Can't open named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't set state of named pipe to host: %-.64s pipe: %-.32s (%lu)", "Can't set state of named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't initialize character set %-.64s (path: %-.64s)",
"Got packet bigger than 'max_allowed_packet'"
}; };
#endif #endif
void init_client_errs(void) void init_client_errs(void)
{ {
errmsg[CLIENT_ERRMAP] = &client_errors[0]; my_errmsg[CLIENT_ERRMAP] = &client_errors[0];
} }
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <my_pthread.h> /* because of signal() */ #include <my_pthread.h> /* because of signal() */
#endif #endif
#define ADMIN_VERSION "8.19" #define ADMIN_VERSION "8.20"
#define MAX_MYSQL_VAR 64 #define MAX_MYSQL_VAR 64
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3 #define MAX_TRUNC_LENGTH 3
...@@ -423,13 +423,8 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -423,13 +423,8 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
my_printf_error(0,"Too few arguments to drop",MYF(ME_BELL)); my_printf_error(0,"Too few arguments to drop",MYF(ME_BELL));
return 1; return 1;
} }
sprintf(buff,"drop database `%.*s`",FN_REFLEN,argv[1]); if (drop_db(mysql,argv[1]))
if (mysql_query(mysql,buff))
{
my_printf_error(0,"DROP DATABASE failed; error: '%-.200s'",
MYF(ME_BELL), mysql_error(mysql));
return 1; return 1;
}
argc--; argv++; argc--; argv++;
break; break;
} }
...@@ -867,7 +862,8 @@ static int drop_db(MYSQL *mysql, const char *db) ...@@ -867,7 +862,8 @@ static int drop_db(MYSQL *mysql, const char *db)
{ {
puts("Dropping the database is potentially a very bad thing to do."); puts("Dropping the database is potentially a very bad thing to do.");
puts("Any data stored in the database will be destroyed.\n"); puts("Any data stored in the database will be destroyed.\n");
printf("Do you really want to drop the '%s' database [y/N]\n",db); printf("Do you really want to drop the '%s' database [y/N] ",db);
fflush(stdout);
VOID(fgets(buf,sizeof(buf)-1,stdin)); VOID(fgets(buf,sizeof(buf)-1,stdin));
if ((*buf != 'y') && (*buf != 'Y')) if ((*buf != 'y') && (*buf != 'Y'))
{ {
...@@ -878,7 +874,7 @@ static int drop_db(MYSQL *mysql, const char *db) ...@@ -878,7 +874,7 @@ static int drop_db(MYSQL *mysql, const char *db)
sprintf(name_buff,"drop database %.*s",FN_REFLEN,db); sprintf(name_buff,"drop database %.*s",FN_REFLEN,db);
if (mysql_query(mysql,name_buff)) if (mysql_query(mysql,name_buff))
{ {
my_printf_error(0,"drop of '%s' failed;\nerror: '%s'",MYF(ME_BELL), my_printf_error(0,"DROP DATABASE %s failed;\nerror: '%s'",MYF(ME_BELL),
db,mysql_error(mysql)); db,mysql_error(mysql));
return 1; return 1;
} }
......
...@@ -569,7 +569,7 @@ int eval_expr(VAR* v, const char* p, const char** p_end) ...@@ -569,7 +569,7 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
else else
{ {
v->str_val = (char*)p; v->str_val = (char*)p;
v->str_val_len = (p_end && *p_end) ? *p_end - p : strlen(p); v->str_val_len = (p_end && *p_end) ? (int) (*p_end - p) : (int) strlen(p);
v->int_val=atoi(p); v->int_val=atoi(p);
v->int_dirty=0; v->int_dirty=0;
return 0; return 0;
......
...@@ -119,6 +119,17 @@ AC_PROG_AWK ...@@ -119,6 +119,17 @@ AC_PROG_AWK
AC_PROG_CC AC_PROG_CC
AC_PROG_CXX AC_PROG_CXX
AC_PROG_CPP AC_PROG_CPP
# Fix for sgi gcc / sgiCC which tries to emulate gcc
if test "$CC" = "sgicc"
then
ac_cv_prog_gcc="no"
fi
if test "$CXX" = "sgi++"
then
GXX="no"
fi
if test "$ac_cv_prog_gcc" = "yes" if test "$ac_cv_prog_gcc" = "yes"
then then
AS="$CC -c" AS="$CC -c"
...@@ -390,7 +401,7 @@ AM_PROG_CC_STDC ...@@ -390,7 +401,7 @@ AM_PROG_CC_STDC
if test "$am_cv_prog_cc_stdc" = "no" if test "$am_cv_prog_cc_stdc" = "no"
then then
AC_MSG_ERROR([MySQL requiers a ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.]) AC_MSG_ERROR([MySQL requires a ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
fi fi
NOINST_LDFLAGS= NOINST_LDFLAGS=
...@@ -1215,7 +1226,7 @@ fi ...@@ -1215,7 +1226,7 @@ fi
AC_SUBST(COMPILATION_COMMENT) AC_SUBST(COMPILATION_COMMENT)
AC_MSG_CHECKING("need of special linking flags") AC_MSG_CHECKING("need of special linking flags")
if test "$IS_LINUX" = "true" -a "$all_is_static" != "yes" if test "$IS_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
then then
LDFLAGS="$LDFLAGS -rdynamic" LDFLAGS="$LDFLAGS -rdynamic"
AC_MSG_RESULT("-rdynamic") AC_MSG_RESULT("-rdynamic")
......
...@@ -303,7 +303,7 @@ static void do_resolve() ...@@ -303,7 +303,7 @@ static void do_resolve()
uchar* addr = (uchar*)read_addr(&p); uchar* addr = (uchar*)read_addr(&p);
if(resolve_addr(addr, &se)) if(resolve_addr(addr, &se))
fprintf(fp_out, "%p %s + %d\n", addr, se.symbol, fprintf(fp_out, "%p %s + %d\n", addr, se.symbol,
addr - se.addr); (int) (addr - se.addr));
else else
fprintf(fp_out, "%p (?)\n", addr); fprintf(fp_out, "%p (?)\n", addr);
......
...@@ -332,7 +332,8 @@ typedef int File; /* File descriptor */ ...@@ -332,7 +332,8 @@ typedef int File; /* File descriptor */
typedef int my_socket; /* File descriptor for sockets */ typedef int my_socket; /* File descriptor for sockets */
#define INVALID_SOCKET -1 #define INVALID_SOCKET -1
#endif #endif
typedef RETSIGTYPE sig_handler; /* Function to handle signals */ /* Type for fuctions that handles signals */
#define sig_handler RETSIGTYPE
typedef void (*sig_return)();/* Returns type from signal */ typedef void (*sig_return)();/* Returns type from signal */
#if defined(__GNUC__) && !defined(_lint) #if defined(__GNUC__) && !defined(_lint)
typedef char pchar; /* Mixed prototypes can take char */ typedef char pchar; /* Mixed prototypes can take char */
......
...@@ -85,7 +85,7 @@ void _nisam_print_key(FILE *stream, register N_KEYSEG *keyseg, const uchar *key) ...@@ -85,7 +85,7 @@ void _nisam_print_key(FILE *stream, register N_KEYSEG *keyseg, const uchar *key)
key=end; key=end;
break; break;
case HA_KEYTYPE_INT24: case HA_KEYTYPE_INT24:
VOID(fprintf(stream,"%ld",sint3korr(key))); VOID(fprintf(stream,"%ld",(long) sint3korr(key)));
key=end; key=end;
break; break;
case HA_KEYTYPE_UINT24: case HA_KEYTYPE_UINT24:
......
...@@ -369,6 +369,8 @@ mysql_install_db () { ...@@ -369,6 +369,8 @@ mysql_install_db () {
error "Could not install slave test DBs" error "Could not install slave test DBs"
exit 1 exit 1
fi fi
# Give mysqld some time to die.
sleep $SLEEP_TIME
return 0 return 0
} }
......
...@@ -67,3 +67,16 @@ t1 0 PRIMARY 1 f1 A 1 NULL NULL ...@@ -67,3 +67,16 @@ t1 0 PRIMARY 1 f1 A 1 NULL NULL
t1 0 PRIMARY 2 f2 A 3 NULL NULL t1 0 PRIMARY 2 f2 A 3 NULL NULL
t1 0 PRIMARY 3 f3 A 9 NULL NULL t1 0 PRIMARY 3 f3 A 9 NULL NULL
t1 0 PRIMARY 4 f4 A 18 NULL NULL t1 0 PRIMARY 4 f4 A 18 NULL NULL
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) NOT NULL default '0'
) TYPE=MyISAM
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`a` int(11) NOT NULL default '0'
) TYPE=MyISAM
Table Create Table
t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien'
) TYPE=MyISAM COMMENT='it''s a table'
Table Create Table
t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien'
) TYPE=MyISAM COMMENT='it''s a table'
...@@ -48,3 +48,20 @@ show index from t1; ...@@ -48,3 +48,20 @@ show index from t1;
repair table t1; repair table t1;
show index from t1; show index from t1;
drop table t1; drop table t1;
#
# Test of SHOW CREATE
#
create temporary table t1 (a int not null);
show create table t1;
alter table t1 rename t2;
show create table t2;
drop table t2;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
name char(20) default 'O''Brien'
) comment = 'it\'s a table' ;
show create table t1 ;
drop table t1;
use test;
drop table if exists t1;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
name char(20) default 'O''Brien'
) comment = 'it\'s a table' ;
show create table t1 ;
drop table t1;
...@@ -62,9 +62,10 @@ do ...@@ -62,9 +62,10 @@ do
done done
for i in extra/comp_err extra/replace extra/perror extra/resolveip \ for i in extra/comp_err extra/replace extra/perror extra/resolveip \
extra/my_print_defaults isam/isamchk isam/pack_isam myisam/myisamchk \ extra/my_print_defaults extra/resolve_stack_dump \
isam/isamchk isam/pack_isam myisam/myisamchk \
myisam/myisampack sql/mysqld sql/mysqlbinlog \ myisam/myisampack sql/mysqld sql/mysqlbinlog \
client/mysql sql/mysqld client/mysqlshow \ client/mysql sql/mysqld client/mysqlshow client/mysqlcheck \
client/mysqladmin client/mysqldump client/mysqlimport client/mysqltest \ client/mysqladmin client/mysqldump client/mysqlimport client/mysqltest \
client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \ client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \
client/.libs/mysqldump client/.libs/mysqlimport client/.libs/mysqltest client/.libs/mysqldump client/.libs/mysqlimport client/.libs/mysqltest
......
...@@ -49,7 +49,7 @@ typedef struct st_sort_param { ...@@ -49,7 +49,7 @@ typedef struct st_sort_param {
uint sort_length; /* Length of sortarg */ uint sort_length; /* Length of sortarg */
uint keys; /* Max antal nycklar / buffert */ uint keys; /* Max antal nycklar / buffert */
uint ref_length; /* Length of record ref. */ uint ref_length; /* Length of record ref. */
ha_rows max_rows; ha_rows max_rows,examined_rows;
TABLE *sort_form; /* For quicker make_sortkey */ TABLE *sort_form; /* For quicker make_sortkey */
SORT_FIELD *local_sortorder; SORT_FIELD *local_sortorder;
SORT_FIELD *end; SORT_FIELD *end;
...@@ -91,7 +91,8 @@ static uint sortlength(SORT_FIELD *sortorder,uint length); ...@@ -91,7 +91,8 @@ static uint sortlength(SORT_FIELD *sortorder,uint length);
open a new file is opened */ open a new file is opened */
ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length, ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
SQL_SELECT *select, ha_rows special, ha_rows max_rows) SQL_SELECT *select, ha_rows special, ha_rows max_rows,
ha_rows *examined_rows)
{ {
int error; int error;
uint memavl,old_memavl,maxbuffer,skr; uint memavl,old_memavl,maxbuffer,skr;
...@@ -113,6 +114,7 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length, ...@@ -113,6 +114,7 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
param.ref_length= table[0]->file->ref_length; param.ref_length= table[0]->file->ref_length;
param.sort_length=sortlength(sortorder,s_length)+ param.ref_length; param.sort_length=sortlength(sortorder,s_length)+ param.ref_length;
param.max_rows= max_rows; param.max_rows= max_rows;
param.examined_rows=0;
if (select && select->quick) if (select && select->quick)
{ {
...@@ -259,7 +261,7 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length, ...@@ -259,7 +261,7 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
my_error(ER_FILSORT_ABORT,MYF(ME_ERROR+ME_WAITTANG)); my_error(ER_FILSORT_ABORT,MYF(ME_ERROR+ME_WAITTANG));
else else
statistic_add(filesort_rows, records, &LOCK_status); statistic_add(filesort_rows, records, &LOCK_status);
*examined_rows= param.examined_rows;
#ifdef SKIPP_DBUG_IN_FILESORT #ifdef SKIPP_DBUG_IN_FILESORT
DBUG_POP(); /* Ok to DBUG */ DBUG_POP(); /* Ok to DBUG */
#endif #endif
...@@ -367,6 +369,8 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, ...@@ -367,6 +369,8 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
file->rnd_end(); file->rnd_end();
DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */ DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */
} }
if (error == 0)
param->examined_rows++;
if (error == 0 && (!select || select->skipp_record() == 0)) if (error == 0 && (!select || select->skipp_record() == 0))
{ {
if (idx == param->keys) if (idx == param->keys)
......
...@@ -825,10 +825,11 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length, ...@@ -825,10 +825,11 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
{ {
/* For slow query log */ /* For slow query log */
if (my_b_printf(&log_file, if (my_b_printf(&log_file,
"# Time: %lu Lock_time: %lu Rows_sent: %lu\n", "# Time: %lu Lock_time: %lu Rows_sent: %lu Rows_examined: %lu\n",
(ulong) (current_time - query_start), (ulong) (current_time - query_start),
(ulong) (thd->time_after_lock - query_start), (ulong) (thd->time_after_lock - query_start),
(ulong) thd->sent_row_count) == (uint) -1) (ulong) thd->sent_row_count,
(ulong) thd->examined_row_count) == (uint) -1)
tmp_errno=errno; tmp_errno=errno;
} }
if (thd->db && strcmp(thd->db,db)) if (thd->db && strcmp(thd->db,db))
......
...@@ -602,7 +602,8 @@ void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form, ...@@ -602,7 +602,8 @@ void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
int use_record_cache, bool print_errors); int use_record_cache, bool print_errors);
void end_read_record(READ_RECORD *info); void end_read_record(READ_RECORD *info);
ha_rows filesort(TABLE **form,struct st_sort_field *sortorder, uint s_length, ha_rows filesort(TABLE **form,struct st_sort_field *sortorder, uint s_length,
SQL_SELECT *select, ha_rows special,ha_rows max_rows); SQL_SELECT *select, ha_rows special,ha_rows max_rows,
ha_rows *examined_rows);
void change_double_for_sort(double nr,byte *to); void change_double_for_sort(double nr,byte *to);
int get_quick_record(SQL_SELECT *select); int get_quick_record(SQL_SELECT *select);
int calc_weekday(long daynr,bool sunday_first_day_of_week); int calc_weekday(long daynr,bool sunday_first_day_of_week);
......
...@@ -58,6 +58,7 @@ static struct option long_options[] = ...@@ -58,6 +58,7 @@ static struct option long_options[] =
{"table", required_argument, 0, 't'}, {"table", required_argument, 0, 't'},
{"user", required_argument, 0, 'u'}, {"user", required_argument, 0, 'u'},
{"version", no_argument, 0, 'V'}, {"version", no_argument, 0, 'V'},
{0, 0, 0, 0}
}; };
void sql_print_error(const char *format,...); void sql_print_error(const char *format,...);
......
...@@ -1388,7 +1388,7 @@ static void *signal_hand(void *arg __attribute__((unused))) ...@@ -1388,7 +1388,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
if (!(opt_specialflag & SPECIAL_NO_PRIOR)) if (!(opt_specialflag & SPECIAL_NO_PRIOR))
my_pthread_attr_setprio(&connection_attrib,INTERRUPT_PRIOR); my_pthread_attr_setprio(&connection_attrib,INTERRUPT_PRIOR);
if (pthread_create(&tmp,&connection_attrib, kill_server_thread, if (pthread_create(&tmp,&connection_attrib, kill_server_thread,
(void*) sig)) (void*) 0))
sql_print_error("Error: Can't create thread to kill server"); sql_print_error("Error: Can't create thread to kill server");
#else #else
kill_server((void*) sig); // MIT THREAD has a alarm thread kill_server((void*) sig); // MIT THREAD has a alarm thread
......
...@@ -1508,8 +1508,9 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, ...@@ -1508,8 +1508,9 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
tmp_table->reginfo.lock_type=TL_WRITE; // Simulate locked tmp_table->reginfo.lock_type=TL_WRITE; // Simulate locked
tmp_table->tmp_table = 1; tmp_table->tmp_table = 1;
tmp_table->table_cache_key=(char*) (tmp_table+1); tmp_table->table_cache_key=(char*) (tmp_table+1);
tmp_table->key_length= (uint) (strmov(strmov(tmp_table->table_cache_key,db) tmp_table->key_length= (uint) (strmov((tmp_table->real_name=
+1, table_name) strmov(tmp_table->table_cache_key,db)
+1), table_name)
- tmp_table->table_cache_key)+1; - tmp_table->table_cache_key)+1;
int4store(tmp_table->table_cache_key + tmp_table->key_length, int4store(tmp_table->table_cache_key + tmp_table->key_length,
thd->slave_proxy_id); thd->slave_proxy_id);
......
...@@ -265,7 +265,7 @@ class THD :public ilink { ...@@ -265,7 +265,7 @@ class THD :public ilink {
#endif #endif
ulonglong next_insert_id,last_insert_id,current_insert_id; ulonglong next_insert_id,last_insert_id,current_insert_id;
ha_rows select_limit,offset_limit,default_select_limit,cuted_fields, ha_rows select_limit,offset_limit,default_select_limit,cuted_fields,
max_join_size,sent_row_count; max_join_size, sent_row_count, examined_row_count;
table_map used_tables; table_map used_tables;
ulong query_id,version, inactive_timeout,options,thread_id; ulong query_id,version, inactive_timeout,options,thread_id;
ulong gemini_spin_retries; ulong gemini_spin_retries;
......
...@@ -2266,7 +2266,7 @@ mysql_init_query(THD *thd) ...@@ -2266,7 +2266,7 @@ mysql_init_query(THD *thd)
thd->lex.table_list.next= (byte**) &thd->lex.table_list.first; thd->lex.table_list.next= (byte**) &thd->lex.table_list.first;
thd->fatal_error=0; // Safety thd->fatal_error=0; // Safety
thd->last_insert_id_used=thd->query_start_used=thd->insert_id_used=0; thd->last_insert_id_used=thd->query_start_used=thd->insert_id_used=0;
thd->sent_row_count=0; thd->sent_row_count=thd->examined_row_count=0;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -265,7 +265,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, ...@@ -265,7 +265,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
join.join_tab=0; join.join_tab=0;
join.tmp_table_param.copy_field=0; join.tmp_table_param.copy_field=0;
join.sum_funcs=0; join.sum_funcs=0;
join.send_records=join.found_records=0; join.send_records=join.found_records=join.examined_rows=0;
join.tmp_table_param.end_write_records= HA_POS_ERROR; join.tmp_table_param.end_write_records= HA_POS_ERROR;
join.first_record=join.sort_and_group=0; join.first_record=join.sort_and_group=0;
join.select_options=select_options; join.select_options=select_options;
...@@ -784,6 +784,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds, ...@@ -784,6 +784,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
error=do_select(&join,&fields,NULL,procedure); error=do_select(&join,&fields,NULL,procedure);
err: err:
thd->examined_row_count=join.examined_rows;
thd->proc_info="end"; thd->proc_info="end";
join.lock=0; // It's faster to unlock later join.lock=0; // It's faster to unlock later
join_free(&join); join_free(&join);
...@@ -867,6 +868,7 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds, ...@@ -867,6 +868,7 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
table->reginfo.not_exists_optimize=0; table->reginfo.not_exists_optimize=0;
bzero((char*) table->const_key_parts, sizeof(key_part_map)*table->keys); bzero((char*) table->const_key_parts, sizeof(key_part_map)*table->keys);
all_table_map|= table->map; all_table_map|= table->map;
s->join=join;
if ((s->on_expr=tables->on_expr)) if ((s->on_expr=tables->on_expr))
{ {
// table->maybe_null=table->outer_join=1; // Mark for send fields // table->maybe_null=table->outer_join=1; // Mark for send fields
...@@ -2219,6 +2221,7 @@ make_simple_join(JOIN *join,TABLE *tmp_table) ...@@ -2219,6 +2221,7 @@ make_simple_join(JOIN *join,TABLE *tmp_table)
join_tab->ref.key = -1; join_tab->ref.key = -1;
join_tab->not_used_in_distinct=0; join_tab->not_used_in_distinct=0;
join_tab->read_first_record= join_init_read_record; join_tab->read_first_record= join_init_read_record;
join_tab->join=join;
bzero((char*) &join_tab->read_record,sizeof(join_tab->read_record)); bzero((char*) &join_tab->read_record,sizeof(join_tab->read_record));
tmp_table->status=0; tmp_table->status=0;
tmp_table->null_row=0; tmp_table->null_row=0;
...@@ -3915,8 +3918,8 @@ bool create_myisam_from_heap(TABLE *table, TMP_TABLE_PARAM *param, int error, ...@@ -3915,8 +3918,8 @@ bool create_myisam_from_heap(TABLE *table, TMP_TABLE_PARAM *param, int error,
table->file=0; table->file=0;
*table =new_table; *table =new_table;
table->file->change_table_ptr(table); table->file->change_table_ptr(table);
thd->proc_info= (!strcmp(save_proc_info,"Copying to tmp table") ?
thd->proc_info=save_proc_info; "Copying to tmp table on disk" : save_proc_info);
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
...@@ -4096,6 +4099,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records) ...@@ -4096,6 +4099,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
bool not_used_in_distinct=join_tab->not_used_in_distinct; bool not_used_in_distinct=join_tab->not_used_in_distinct;
ha_rows found_records=join->found_records; ha_rows found_records=join->found_records;
READ_RECORD *info= &join_tab->read_record; READ_RECORD *info= &join_tab->read_record;
join->examined_rows++;
do do
{ {
...@@ -4483,6 +4487,7 @@ join_init_read_next_with_key(READ_RECORD *info) ...@@ -4483,6 +4487,7 @@ join_init_read_next_with_key(READ_RECORD *info)
return 0; return 0;
} }
static int static int
join_init_read_last_with_key(JOIN_TAB *tab) join_init_read_last_with_key(JOIN_TAB *tab)
{ {
...@@ -5204,6 +5209,7 @@ create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit) ...@@ -5204,6 +5209,7 @@ create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit)
{ {
SORT_FIELD *sortorder; SORT_FIELD *sortorder;
uint length; uint length;
ha_rows examined_rows;
TABLE *table=tab->table; TABLE *table=tab->table;
SQL_SELECT *select=tab->select; SQL_SELECT *select=tab->select;
DBUG_ENTER("create_sort_index"); DBUG_ENTER("create_sort_index");
...@@ -5242,12 +5248,13 @@ create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit) ...@@ -5242,12 +5248,13 @@ create_sort_index(JOIN_TAB *tab,ORDER *order,ha_rows select_limit)
} }
} }
table->found_records=filesort(&table,sortorder,length, table->found_records=filesort(&table,sortorder,length,
select, 0L, select_limit); select, 0L, select_limit, &examined_rows);
delete select; // filesort did select delete select; // filesort did select
tab->select=0; tab->select=0;
tab->select_cond=0; tab->select_cond=0;
tab->type=JT_ALL; // Read with normal read_record tab->type=JT_ALL; // Read with normal read_record
tab->read_first_record= join_init_read_record; tab->read_first_record= join_init_read_record;
tab->join->examined_rows+=examined_rows;
if (table->key_read) // Restore if we used indexes if (table->key_read) // Restore if we used indexes
{ {
table->key_read=0; table->key_read=0;
......
...@@ -102,6 +102,7 @@ typedef struct st_join_table { ...@@ -102,6 +102,7 @@ typedef struct st_join_table {
bool cached_eq_ref_table,eq_ref_table,not_used_in_distinct; bool cached_eq_ref_table,eq_ref_table,not_used_in_distinct;
TABLE_REF ref; TABLE_REF ref;
JOIN_CACHE cache; JOIN_CACHE cache;
JOIN *join;
} JOIN_TAB; } JOIN_TAB;
...@@ -151,7 +152,7 @@ class JOIN { ...@@ -151,7 +152,7 @@ class JOIN {
uint send_group_parts; uint send_group_parts;
bool sort_and_group,first_record,full_join,group, no_field_update; bool sort_and_group,first_record,full_join,group, no_field_update;
table_map const_table_map,outer_join; table_map const_table_map,outer_join;
ha_rows send_records,found_records; ha_rows send_records,found_records,examined_rows,row_limit;
POSITION positions[MAX_TABLES+1],best_positions[MAX_TABLES+1]; POSITION positions[MAX_TABLES+1],best_positions[MAX_TABLES+1];
double best_read; double best_read;
List<Item> *fields; List<Item> *fields;
......
...@@ -781,6 +781,9 @@ store_create_info(THD *thd, TABLE *table, String *packet) ...@@ -781,6 +781,9 @@ store_create_info(THD *thd, TABLE *table, String *packet)
List<Item> field_list; List<Item> field_list;
char tmp[MAX_FIELD_WIDTH]; char tmp[MAX_FIELD_WIDTH];
String type(tmp, sizeof(tmp)); String type(tmp, sizeof(tmp));
if (table->tmp_table)
packet->append("CREATE TEMPORARY TABLE ", 23);
else
packet->append("CREATE TABLE ", 13); packet->append("CREATE TABLE ", 13);
append_identifier(thd,packet,table->real_name); append_identifier(thd,packet,table->real_name);
packet->append(" (\n", 3); packet->append(" (\n", 3);
......
...@@ -1633,6 +1633,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, ...@@ -1633,6 +1633,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
TABLE_LIST tables; TABLE_LIST tables;
List<Item> fields; List<Item> fields;
List<Item> all_fields; List<Item> all_fields;
ha_rows examined_rows;
DBUG_ENTER("copy_data_between_tables"); DBUG_ENTER("copy_data_between_tables");
if (!(copy= new Copy_field[to->fields])) if (!(copy= new Copy_field[to->fields]))
...@@ -1668,7 +1669,8 @@ copy_data_between_tables(TABLE *from,TABLE *to, ...@@ -1668,7 +1669,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
if (setup_order(thd, &tables, fields, all_fields, order) || if (setup_order(thd, &tables, fields, all_fields, order) ||
!(sortorder=make_unireg_sortorder(order, &length)) || !(sortorder=make_unireg_sortorder(order, &length)) ||
(from->found_records = filesort(&from, sortorder, length, (from->found_records = filesort(&from, sortorder, length,
(SQL_SELECT *) 0, 0L, HA_POS_ERROR)) (SQL_SELECT *) 0, 0L, HA_POS_ERROR,
&examined_rows))
== HA_POS_ERROR) == HA_POS_ERROR)
goto err; goto err;
}; };
......
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