summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Docs/internals.texi59
-rw-r--r--Docs/manual.texi422
-rw-r--r--client/mysql.cc26
-rw-r--r--client/mysqlimport.c3
-rw-r--r--include/config-win.h2
-rw-r--r--include/global.h2
-rw-r--r--libmysql/libmysql.c7
-rw-r--r--myisam/ChangeLog4
-rw-r--r--myisam/Makefile.am2
-rw-r--r--myisam/ft_stopwords.c2
-rw-r--r--myisam/mi_delete_table.c7
-rw-r--r--myisam/mi_rename.c8
-rw-r--r--myisam/mi_rnext.c2
-rw-r--r--myisam/mi_rprev.c2
-rw-r--r--myisam/mi_search.c1
-rw-r--r--myisam/myisamdef.h2
-rwxr-xr-xscripts/make_binary_distribution.sh2
-rw-r--r--sql/ha_heap.cc15
-rw-r--r--sql/ha_heap.h5
-rw-r--r--sql/handler.cc4
-rw-r--r--sql/handler.h2
-rw-r--r--sql/lock.cc22
-rw-r--r--sql/mini_client.cc5
-rw-r--r--sql/mysql_priv.h5
-rw-r--r--sql/mysqld.cc15
-rw-r--r--sql/opt_range.cc12
-rw-r--r--sql/sql_base.cc35
-rw-r--r--sql/sql_parse.cc12
-rw-r--r--sql/sql_select.cc8
-rw-r--r--sql/table.h1
-rwxr-xr-xtests/drop_test.pl220
-rwxr-xr-xtests/fork_test.pl2
-rwxr-xr-xtests/rename_test.pl204
33 files changed, 909 insertions, 211 deletions
diff --git a/Docs/internals.texi b/Docs/internals.texi
index 5676fcd2bb5..532a1ebe53d 100644
--- a/Docs/internals.texi
+++ b/Docs/internals.texi
@@ -143,6 +143,65 @@ same tables.
and then we read the rows in the sorted order into a row buffer
(record_buffer) .
+@node Coding guidelines
+@chapter Coding guidelines
+
+- We are using bitkeeper (www.bitkeeper.com) for source management.
+- You should use the MySQL 3.23 or MySQL 4.0 source for all developments.
+- If you have any questions about the MySQL source, you can post these
+ to developers@mysql.com and we will answer them.
+ Note that we will shortly change the name of this list to
+ internals@mysql.com, to more accurately reflect what should be
+ posted to this list.
+
+- Try to write code in a lot of black boxes that can be reused or at
+ least have a clean interface
+- Reuse code; There is already in MySQL a lot of algorithms for list handling,
+ queues, dynamic and hashed arrays, sorting...) that can be reused.
+- Try to always write optimized code, so that you don't have to
+ go back and rewrite it a couple of months later. It's better to
+ spend 3 times as much time designing and writing and optimal function than
+ having to do it all over again later on.
+- Avoid CPU wasteful code, even where it does not matter, so that
+ you will not develop sloppy coding habits.
+- If you can write it in fewer lines, do it (as long as the code will not
+ be slower or much harder to read)
+- do not check the same pointer for NULL more than once.
+- Use long function and variable names in English; This makes your
+ code easier to read.
+- Think assembly - make it easier for the compiler to optimize your code.
+- Comment your code when you do something that someone else may think
+ is 'not trivial'.
+- Use the my_ functions like my_read/my_write/my_malloc() that you can
+ find in the mysys library instead of the direct system calls; This
+ will make your code easier to debug and more portable.
+- use libstring functions instead of standard libc string functions
+ whenever possible
+- Avoid using alloc (its REAL slow); For memory allocations that only
+ needs to live for the lifetime of one thread, on should use
+ sql_alloc() instead.
+- Before doing big design decision, please first post a summary of
+ what you want to do, why you want to do it and how you plan to do
+ it. This way we can easily provide you with feedback and also
+ easily discuss is throughly if some other developer thinks there is better
+ way to do the same thing!
+
+- Use my_var as opposed to myVar or MyVar ( _ rather than dancing SHIFT
+ to spearate words in identifiers)
+- class names start with a capital
+- structure types are typedefed to all caps identifier
+- #defines are capitalized
+- matching { are in the same column
+ - functions return 0 on success , non-zero on error, so you can do
+ if(a() || b() || c()) { error("something went wrong");}
+- goto is ok if not abused
+- avoid default variable initalizations, use LINT_INIT() if the
+ compiler complains after making sure that there is really no way
+ the variable can be used uninitialized
+- Do not instantiate a class if you do not have to
+- Use pointers rather than array indexing when operating on strings
+
+
@node Index
@unnumbered Index
diff --git a/Docs/manual.texi b/Docs/manual.texi
index e0e8ba56276..05df67c3371 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -178,7 +178,7 @@ Installing MySQL
* MIT-pthreads:: MIT-pthreads notes
* Perl support:: Perl installation comments
* Source install system issues:: System-specific issues
-* Win32:: Win32 notes
+* Windows:: Windows notes
* OS/2:: OS/2 notes
* MySQL binaries::
* Post-installation:: Post-installation setup and testing
@@ -204,8 +204,8 @@ Installing a MySQL source distribution
Perl installation comments
* Perl installation:: Installing Perl on Unix
-* ActiveState Perl:: Installing ActiveState Perl on Win32
-* Win32 Perl:: Installing the @strong{MySQL} Perl distribution on Win32
+* ActiveState Perl:: Installing ActiveState Perl on Windows
+* Windows Perl:: Installing the @strong{MySQL} Perl distribution on Windows
* Perl support problems:: Problems using the Perl @code{DBI}/@code{DBD} interface
System-specific issues
@@ -246,16 +246,16 @@ BSD/OS notes
* BSDI3:: BSD/OS 3.x notes
* BSDI4:: BSD/OS 4.x notes
-Win32 notes
+Windows notes
-* Win32 installation:: Installing @strong{MySQL} on Win32
+* Windows installation:: Installing @strong{MySQL} on Windows
* Win95 start:: Starting @strong{MySQL} on Win95 / Win98
* NT start:: Starting @strong{MySQL} on NT / Win2000
-* Win32 running:: Running @strong{MySQL} on Win32
-* Win32 and SSH:: Connecting to a remote @strong{MySQL} from Win32 with SSH
-* Win32 symbolic links:: Splitting data across different disks under Win32
-* Win32 compiling::
-* Win32 vs Unix:: @strong{MySQL}-Win32 compared to Unix @strong{MySQL}
+* Windows running:: Running @strong{MySQL} on Windows
+* Windows and SSH:: Connecting to a remote @strong{MySQL} from Windows with SSH
+* Windows symbolic links:: Splitting data across different disks under Windows
+* Windows compiling:: Compiling MySQL clients on Windows.
+* Windows vs Unix:: @strong{MySQL}-Windows compared to Unix @strong{MySQL}
Post-installation setup and testing
@@ -275,7 +275,7 @@ Is there anything special to do when upgrading/downgrading MySQL?
How standards-compatible is MySQL?
* 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
* Missing functions:: Functionality missing from @strong{MySQL}
* Standards:: What standards does @strong{MySQL} follow?
@@ -337,7 +337,7 @@ MySQL language reference
* LOAD DATA:: @code{LOAD DATA INFILE} syntax
* UPDATE:: @code{UPDATE} syntax
* USE:: @code{USE} syntax
-* FLUSH:: @code{FLUSH} syntax (clearing caches)
+* FLUSH:: @code{Flush} syntax (clearing caches)
* KILL:: @code{KILL} syntax
* SHOW:: @code{SHOW} syntax (Get information about tables, columns, ...)
* EXPLAIN:: @code{EXPLAIN} syntax (Get information about a @code{SELECT})
@@ -641,8 +641,9 @@ Some common errors when using MySQL
* Too many connections:: @code{Too many connections} error
* Out of memory:: @code{Out of memory} error
* Packet too large:: @code{Packet too large} error
-* Communication errors::
+* Communication errors:: Communication errors / Aborted connection
* Full table:: @code{The table is full} error
+* Cannot create::
* Commands out of sync:: @code{Commands out of sync} error in client
* Ignoring user:: @code{Ignoring user} error
* Cannot find table:: @code{Table 'xxx' doesn't exist} error
@@ -761,7 +762,7 @@ MySQL change history
* News-3.20.x:: Changes in release 3.20.x
* News-3.19.x:: Changes in release 3.19.x
-Changes in release 3.23.x (Released as beta)
+Changes in release 3.23.x (Recommended; beta)
* News-3.23.23:: Changes in release 3.23.23
* News-3.23.22:: Changes in release 3.23.22
@@ -1464,7 +1465,7 @@ which allows host-based verification. Passwords are secure because all
password traffic when connecting to a server is encrypted.
@item
-ODBC (Open-DataBase-Connectivity) support for Windows95 (with source). All
+ODBC (Open-DataBase-Connectivity) support for Win32 (with source). All
ODBC 2.5 functions and many others. For example, you can use MS Access to
connect to your @strong{MySQL} server. @xref{ODBC}.
@@ -1551,7 +1552,7 @@ languages. @xref{Languages}.
@item
Clients may connect to the @strong{MySQL} server using TCP/IP Sockets,
-Unix Sockets (Unixes), or Named Pipes (Windows NT).
+Unix Sockets (Unixes), or Named Pipes (NT).
@item
The @strong{MySQL}-specific @code{SHOW} command can be used to retrieve
@@ -1923,8 +1924,8 @@ organization.
@uref{http://www.penguinpowered.com/~kmysql, KMySQL}
KMySQL is a database client for KDE that primarily supports @strong{MySQL}.
@item
-@uref{http://www.ecker-software.de, Win32 GUI client}
-A Win32 GUI client by David Ecker.
+@uref{http://www.ecker-software.de, Windows GUI client}
+A Windows GUI client by David Ecker.
@item
@uref{http://www.icaap.org/software/kiosk/, Kiosk; a @strong{MySQL} client for
database management}. Written in Perl. Will be a part of Bazaar.
@@ -2381,7 +2382,7 @@ A digest version of the @code{java} list.
@item win32
All things concerning @strong{MySQL} on Microsoft operating systems such as
-Windows NT.
+Win95, Win98, NT and Win2000.
@item win32-digest
A digest version of the @code{win32} list.
@@ -3356,7 +3357,7 @@ encounter per year, but we are as always very flexible towards our customers!
* MIT-pthreads:: MIT-pthreads notes
* Perl support:: Perl installation comments
* Source install system issues:: System-specific issues
-* Win32:: Win32 notes
+* Windows:: Windows notes
* OS/2:: OS/2 notes
* MySQL binaries::
* Post-installation:: Post-installation setup and testing
@@ -4012,7 +4013,7 @@ SCO UnixWare 7.0.1. @xref{SCO Unixware}.
@item
Tru64 Unix
@item
-Win95, Win98, NT and Win2000. @xref{Win32}.
+Win95, Win98, NT and Win2000. @xref{Windows}.
@end itemize
@cindex @strong{MySQL} binary distribution
@@ -4582,6 +4583,25 @@ stable compiler available.
@strong{MySQL} Perl support requires Perl 5.004_03 or newer.
+On some Linux 2.2 versions, you may get the error @code{Resource
+temporarily unavailable} when you do a lot of new connections to a
+@code{mysqld} server over TCP/IP.
+
+The problem is that Linux has a delay between when you close a TCP/IP
+socket and until this is actually freed by the system. As there is only
+room for a finite number of TCP/IP slots you will get the above error if
+you try to do too many new TCP/IP connections during a small time, like
+when you run the @strong{MySQL} @file{test-connect} benchmark over
+TCP/IP.
+
+We have mailed about this problem a couple of times to different Linux
+mailing lists but have never been able to resolve this properly :(
+
+The only known 'fix' to this problem is to use persistent connections in
+your clients or use sockets, if you are running the database server
+and clients on the same machine. We hope that the @code{Linux 2.4}
+kernel will fix this problem in the future.
+
@node Binary notes-HP-UX, , Binary notes-Linux, Binary install system issues
@subsubsection HP-UX notes
@@ -5332,8 +5352,8 @@ needed, but may be interesting for someone.)
@menu
* Perl installation:: Installing Perl on Unix
-* ActiveState Perl:: Installing ActiveState Perl on Win32
-* Win32 Perl:: Installing the @strong{MySQL} Perl distribution on Win32
+* ActiveState Perl:: Installing ActiveState Perl on Windows
+* Windows Perl:: Installing the @strong{MySQL} Perl distribution on Windows
* Perl support problems:: Problems using the Perl @code{DBI}/@code{DBD} interface
@end menu
@@ -5407,11 +5427,11 @@ you:
Look under the heading
@code{Installing New Modules that Require Locally Installed Modules}.
-@node ActiveState Perl, Win32 Perl, Perl installation, Perl support
-@subsection Installing ActiveState Perl on Win32
+@node ActiveState Perl, Windows Perl, Perl installation, Perl support
+@subsection Installing ActiveState Perl on Windows
To install the @strong{MySQL} @code{DBD} module with ActiveState Perl on
-Win32, you should do the following:
+Windows, you should do the following:
@itemize @bullet
@item Open a DOS shell.
@@ -5434,23 +5454,23 @@ $dbh= DBI->connect("DBI:ODBC:$dsn","$user","$password") ||
die "Got error $DBI::errstr when connecting to $dsn\n";
@end example
-@node Win32 Perl, Perl support problems, ActiveState Perl, Perl support
-@subsection Installing the MySQL Perl distribution on Win32
+@node Windows Perl, Perl support problems, ActiveState Perl, Perl support
+@subsection Installing the MySQL Perl distribution on Windows
The @strong{MySQL} Perl distribution contains @code{DBI},
@code{DBD:MySQL} and @code{DBD:ODBC}.
@itemize @bullet
-@item Get the Perl distribution for Win32 from
+@item Get the Perl distribution for Windows from
@uref{http://www.mysql.com/download.html}.
@item Unzip the distribution in @code{C:} so that you get a @file{C:\PERL} directory.
@item Add the directory @file{C:\PERL\BIN} to your path.
-@item Add the directory @file{C:\PERL\BIN\MSWin32-x86-thread} or
-@file{C:\PERL\BIN\MSWin32-x86} to your path.
+@item Add the directory @file{C:\PERL\BIN\MSWIN32-x86-thread} or
+@file{C:\PERL\BIN\MSWIN32-x86} to your path.
@item Test that @code{perl} works by executing @code{perl -v} in a DOS shell.
@end itemize
-@node Perl support problems, , Win32 Perl, Perl support
+@node Perl support problems, , Windows Perl, Perl support
@subsection Problems using the Perl @code{DBI}/@code{DBD} interface
If Perl reports that it can't find the @code{../mysql/mysql.so} module,
@@ -5561,7 +5581,7 @@ shell> make perl
Finally, you should install this new Perl. Again, the output of @code{make
perl} indicates the command to use.
-@node Source install system issues, Win32, Perl support, Installing
+@node Source install system issues, Windows, Perl support, Installing
@section System-specific issues
The following sections indicate some of the issues that have been observed to
@@ -7024,26 +7044,26 @@ alias mysql '/usr/local/mysql/bin/mysql'
alias mysqladmin '/usr/local/mysql/libexec/mysqladmin'
@end example
-@node Win32, OS/2, Source install system issues, Installing
-@section Win32 notes
+@node Windows, OS/2, Source install system issues, Installing
+@section Windows notes
-This section describes installation and use of @strong{MySQL} on Win32. This
+This section describes installation and use of @strong{MySQL} on Windows. This
is also described in the @file{README} file that comes with the
-@strong{MySQL} Win32 distribution.
+@strong{MySQL} Windows distribution.
@menu
-* Win32 installation:: Installing @strong{MySQL} on Win32
+* Windows installation:: Installing @strong{MySQL} on Windows
* Win95 start:: Starting @strong{MySQL} on Win95 / Win98
* NT start:: Starting @strong{MySQL} on NT / Win2000
-* Win32 running:: Running @strong{MySQL} on Win32
-* Win32 and SSH:: Connecting to a remote @strong{MySQL} from Win32 with SSH
-* Win32 symbolic links:: Splitting data across different disks under Win32
-* Win32 compiling::
-* Win32 vs Unix:: @strong{MySQL}-Win32 compared to Unix @strong{MySQL}
+* Windows running:: Running @strong{MySQL} on Windows
+* Windows and SSH:: Connecting to a remote @strong{MySQL} from Windows with SSH
+* Windows symbolic links:: Splitting data across different disks under Win32
+* Windows compiling:: Compiling MySQL clients on Windows.
+* Windows vs Unix:: @strong{MySQL}-Windows compared to Unix @strong{MySQL}
@end menu
-@node Win32 installation, Win95 start, Win32, Win32
-@subsection Installing MySQL on Win32
+@node Windows installation, Win95 start, Windows, Windows
+@subsection Installing MySQL on Windows
If you don't have a registered version of @strong{MySQL}, you should first
download the shareware version from:
@@ -7057,7 +7077,7 @@ probably also need the @strong{MyODBC} driver. You can find this at the
To install either distribution, unzip it in some empty directory and run the
@code{Setup.exe} program.
-By default, @strong{MySQL}-Win32 is configured to be installed in
+By default, @strong{MySQL}-Windows is configured to be installed in
@file{C:\mysql}. If you want to install @strong{MySQL} elsewhere, install it
in @file{C:\mysql}, then move the installation to where you want it. If you
do move @strong{MySQL}, you must tell @code{mysqld} where everything is by
@@ -7066,16 +7086,15 @@ display all options! For example, if you have moved the @strong{MySQL}
distribution to @file{D:\programs\mysql}, you must start @code{mysqld} with:
@code{D:\programs\mysql\bin\mysqld --basedir D:\programs\mysql}
-With the registered version of @strong{MySQL}, you can also create a
+With all newer @strong{MySQL} versions, you can also create a
@file{C:\my.cnf} file that holds any default options for the
@strong{MySQL} server. Copy the file @file{\mysql\my-xxxxx.cnf} to
@file{C:\my.cnf} and edit this to suit your setup. Note that you should
specify all paths with @code{/} instead of @code{\}. If you use
@code{\}, you need to specify this twice, as @code{\} is the escape
-character in @strong{MySQL}.
-@xref{Option files}.
+character in @strong{MySQL}. @xref{Option files}.
-@node Win95 start, NT start, Win32 installation, Win32
+@node Win95 start, NT start, Windows installation, Windows
@subsection Starting MySQL on Win95 / Win98
@strong{MySQL} uses TCP/IP to connect a client to a server. (This will
@@ -7127,7 +7146,7 @@ that should contain the reason why @code{mysqld} doesn't start. If you
make a bug report about this, please only send the lines where something
seams to go wrong to the mailing list!
-@node NT start, Win32 running, Win95 start, Win32
+@node NT start, Windows running, Win95 start, Windows
@subsection Starting MySQL on NT / Win200
The Win95/Win98 section also applies to @strong{MySQL} on NT / Win2000, with
@@ -7207,10 +7226,10 @@ C:\mysql\bin\mysqld --standalone --debug
The last version gives you a debug trace in @file{C:\mysqld.trace}.
-@node Win32 running, Win32 and SSH, NT start, Win32
-@subsection Running MySQL on Win32
+@node Windows running, Windows and SSH, NT start, Windows
+@subsection Running MySQL on Windows
-@strong{MySQL} supports TCP/IP on all Win32 platforms and named pipes on NT.
+@strong{MySQL} supports TCP/IP on all Windows platforms and named pipes on NT.
The default is to use named pipes for local connections on NT and TCP/IP for
all other cases if the client has TCP/IP installed. The host name specifies
which protocol is used:
@@ -7247,7 +7266,7 @@ the @strong{MySQL} grant tables. You can also avoid DNS when connecting to a
There are two versions of the @strong{MySQL} command line tool:
@multitable @columnfractions .15 .85
-@item @code{mysql} @tab Compiled on native Win32, which offers very limited text
+@item @code{mysql} @tab Compiled on native Windows, which offers very limited text
editing capabilities.
@item @code{mysqlc} @tab Compiled with the Cygnus GNU compiler and libraries, which offers @code{readline} editing.
@end multitable
@@ -7256,7 +7275,7 @@ If you want to use @code{mysqlc.exe}, you must copy
@file{C:\mysql\lib\cygwinb19.dll} to @file{\windows\system} (or similar
place).
-The default privileges on Win32 give all local users full privileges
+The default privileges on Windows give all local users full privileges
to all databases. To make @strong{MySQL} more secure, you
should set a password for all users and remove the row in the
@code{mysql.user} table that has @code{Host='localhost'} and
@@ -7292,8 +7311,8 @@ With the newer @strong{MySQL} versions you can easily add new users
and change privileges with @code{GRANT} and @code{REVOKE} commands.
@xref{GRANT}.
-@node Win32 and SSH, Win32 symbolic links, Win32 running, Win32
-@subsection Connecting to a remote MySQL from Win32 with SSH
+@node Windows and SSH, Windows symbolic links, Windows running, Windows
+@subsection Connecting to a remote MySQL from Windows with SSH
Here is a note about how to connect to get a secure connection to remote MySQL
server with SSH (by David Carlson).
@@ -7329,8 +7348,8 @@ usegroup!
@findex Symbolic links
@findex Using multiple disks to start data
-@node Win32 symbolic links, Win32 compiling, Win32 and SSH, Win32
-@subsection Splitting data across different disks under Win32
+@node Windows symbolic links, Windows compiling, Windows and SSH, Windows
+@subsection Splitting data across different disks under Windows
On windows @strong{MySQL} 3.23.16 and above is compiled with the
@code{-DUSE_SYMDIR} option. This allows you to put a database on
@@ -7348,7 +7367,7 @@ should create the file @file{C:\mysql\data\foo.sym} that should contains the
text @code{D:\data\foo}. After this, all tables created in the database
@code{foo} will be created in @file{D:\data\foo}.
-@node Win32 compiling, Win32 vs Unix, Win32 symbolic links, Win32
+@node Windows compiling, Windows vs Unix, Windows symbolic links, Windows
@subsection Compiling MySQL clients on Windows.
In your source files, you should include @file{windows.h} before you include
@@ -7368,10 +7387,10 @@ with the static @file{mysqlclient.lib} library.
Note that as the mysqlclient libraries are compiled as threaded libraries,
you should also compile your code to be multi-threaded!
-@node Win32 vs Unix, , Win32 compiling, Win32
-@subsection MySQL-Win32 compared to Unix MySQL
+@node Windows vs Unix, , Windows compiling, Windows
+@subsection MySQL-Windows compared to Unix MySQL
-@strong{MySQL}-Win32 has by now proven itself to be very stable. This version
+@strong{MySQL}-Windows has by now proven itself to be very stable. This version
of @strong{MySQL} has the same features as the corresponding Unix version
with the following exceptions:
@@ -7413,21 +7432,23 @@ connections.
We plan to fix this in the near future.
@item UDF functions
-For the moment, @strong{MySQL}-Win32 does not support user definable functions.
+For the moment, @strong{MySQL}-Windows does not support user definable
+functions.
@item @code{DROP DATABASE}
You can't drop a database that is in use by some thread.
@item Killing @strong{MySQL} from the task manager
You can't kill @strong{MySQL} from the task manager or with the shutdown
-utility in Windows95. You must take it down with @code{mysqladmin shutdown}.
+utility in Win95. You must take it down with @code{mysqladmin shutdown}.
@item Case-insensitive names
-Filenames are case insensitive on Win32, so database and table names
-are also case insensitive in @strong{MySQL} for Win32. The only restriction is
-that database and table names must be given in the same case throughout a
-given statement. The following query would not work because it refers to
-a table both as @code{my_table} and as @code{MY_TABLE}:
+Filenames are case insensitive on Windows, so database and table names
+are also case insensitive in @strong{MySQL} for Windows. The only
+restriction is that database and table names must be given in the same
+case throughout a given statement. The following query would not work
+because it refers to a table both as @code{my_table} and as
+@code{MY_TABLE}:
@example
SELECT * FROM my_table WHERE MY_TABLE.col=1;
@end example
@@ -7443,8 +7464,8 @@ SELECT * INTO OUTFILE 'C:/tmp/skr.txt' FROM skr;
@end example
@item @code{Can't open named pipe} error
-If you use the shareware version of @strong{MySQL}-Win32 on NT with the
-newest mysql-clients you will get the following error:
+If you use an MySQL 3.22 version on NT with the newest mysql-clients you
+will get the following error:
@example
error 2017: can't open named pipe to host: . pipe...
@@ -7475,7 +7496,7 @@ following information:
@end example
@end table
-Here are some open issues for anyone who might want to help us with the Win32
+Here are some open issues for anyone who might want to help us with the Windows
release:
@itemize @bullet
@@ -7511,7 +7532,7 @@ It would be real nice to be able to kill @code{mysqld} from the
task manager. For the moment, you must use @code{mysqladmin shutdown}.
@item
-Port @code{readline} to Win32 for use in the @code{mysql} command line tool.
+Port @code{readline} to Windows for use in the @code{mysql} command line tool.
@item
GUI versions of the standard @strong{MySQL} clients (@code{mysql},
@@ -7520,18 +7541,18 @@ GUI versions of the standard @strong{MySQL} clients (@code{mysql},
@item
It would be nice if the socket ``read'' and ``write'' functions in
@file{net.c} were interruptible. This would make it possible to kill open
-threads with @code{mysqladmin kill} on Win32.
+threads with @code{mysqladmin kill} on Windows.
@item
Documentation of which Windows programs work with
-@strong{MySQL}-Win32/@strong{MyODBC} and what must be done to get them working.
+@strong{MySQL}-Windows/@strong{MyODBC} and what must be done to get them working.
@item
@code{mysqld} always starts in the "C" locale and not in the default locale.
We would like to have @code{mysqld} use the current locale for the sort order.
@item
-Port @code{sqlclient} to Win32 (almost done) and add more features to it!
+Port @code{sqlclient} to Windows (almost done) and add more features to it!
@item
Add more options to MysqlManager.
@@ -7545,14 +7566,14 @@ Implement UDF functions with @code{.DLL}s.
@item
Add macros to use the faster thread-safe increment/decrement methods
-provided by Win32.
+provided by Windows.
@end itemize
-Other Win32-specific issues are described in the @file{README} file that comes
-with the @strong{MySQL}-Win32 distribution.
+Other Windows-specific issues are described in the @file{README} file that comes
+with the @strong{MySQL}-Windows distribution.
-@node OS/2, MySQL binaries, Win32, Installing
+@node OS/2, MySQL binaries, Windows, Installing
@section OS/2 notes
@strong{MySQL} uses quite a few open files. Because of this, you
@@ -8213,7 +8234,7 @@ C:\mysql\bin\mysqld --standalone --debug
This will not run in the background and it should also write a trace in
@file{\mysqld.trace}, which may help you determine the source of your
-problems. @xref{Win32}.
+problems. @xref{Windows}.
@node Automatic start, Command-line options, Starting server, Post-installation
@subsection Starting and stopping MySQL automatically
@@ -8487,7 +8508,7 @@ with @code{--datadir} when @code{mysqld} starts up! (@code{--datadir} has no
effect on where the server looks for option files, because it looks for them
before it processes any command-line arguments.)
-@strong{MySQL} reads default options from the following files on Win32:
+@strong{MySQL} reads default options from the following files on Windows:
@multitable @columnfractions .3 .7
@item @strong{Filename} @tab @strong{Purpose}
@@ -8496,7 +8517,7 @@ before it processes any command-line arguments.)
@item @code{C:\mysql\data\my.cnf} @tab Server-specific options
@end multitable
-Note that you on Win32 should specify all paths with @code{/} instead of
+Note that you on Windows should specify all paths with @code{/} instead of
@code{\}. If you use @code{\}, you need to specify this twice, as
@code{\} is the escape character in @strong{MySQL}.
@@ -8664,9 +8685,13 @@ table to a @code{MyISAM} table with @code{ALTER TABLE} or the Perl script
3.22 and 3.21 clients will work without any problems with a 3.23 server.
-The following lists what you have to watch out for when upgrading to 3.23:
+The following lists tell what you have to watch out for when upgrading to 3.23:
@itemize @bullet
+@item @strong{MySQL} client 'mysql' now starts with option --no-named-commands
+(-g) by default. This option can be disabled with --enable-named-commands
+(-G). This may cause incompatibility problems in some cases, for example
+in SQL scripts that use named commands without a semicolon, etc. !
@item The default return type of @code{IF} will now depend on both arguments
and not only the first argument.
@item @code{AUTO_INCREMENT} will not work with negative numbers.
@@ -11035,8 +11060,8 @@ Other privileges are denied. For example, normal users can't use
@code{mysqladmin shutdown} or @code{mysqladmin processlist}.
@end itemize
-@strong{NOTE:} The default privileges are different for Win32.
-@xref{Win32 running}.
+@strong{NOTE:} The default privileges are different for Windows.
+@xref{Windows running}.
Because your installation is initially wide open, one of the first things you
should do is specify a password for the @strong{MySQL}
@@ -12000,10 +12025,10 @@ In @strong{MySQL}, databases and tables correspond to directories and files
within those directories. Consequently, the case sensitivity of the
underlying operating system determines the case sensitivity of database and
table names. This means database and table names are case sensitive in Unix
-and case insensitive in Win32.
+and case insensitive in Windows.
@strong{Note:} Although database and table names are case insensitive for
-Win32, you should not refer to a given database or table using different
+Windows, you should not refer to a given database or table using different
cases within the same query. The following query would not work because it
refers to a table both as @code{my_table} and as @code{MY_TABLE}:
@@ -16892,6 +16917,10 @@ readable by other clients. Updates and writes to the table are stalled
until the new table is ready. This is done in such a way that all updates
are automatically redirected to the new table without any failed updates.
+Currently @code{OPTIMIZE TABLE} is done by doing an @code{ALTER TABLE},
+but we will soon change this to use the @code{REPAIR} code, which will make
+the repair much faster for @code{MyISAM} tables.
+
@findex CHECK TABLE
@node CHECK TABLE, ANALYZE TABLE, OPTIMIZE TABLE, Reference
@section @code{CHECK TABLE} syntax
@@ -23717,7 +23746,7 @@ if (1)
On windows you can use internal symbolic links to directories by compiling
@strong{MySQL} with @code{-DUSE_SYMDIR}. This allows you to put different
-databases on different disks. @xref{Win32 symbolic links}.
+databases on different disks. @xref{Windows symbolic links}.
@cindex Startup parameters
@node Server parameters, Table cache, Disk issues, System
@@ -25514,19 +25543,33 @@ completion. This gives a quicker start of mysql.
@item -B, --batch
Print results with a tab as separator, each row on a new line. Doesn't use
history file.
+@item
+--character-sets-dir=...
+Directory where character sets are located.
@item -C, --compress
Use compression in server/client protocol.
@item -#, --debug[=...]
Debug log. Default is 'd:t:o,/tmp/mysql.trace'
@item -D, --database=..
Database to use; This is mainly useful in the @code{my.cnf} file.
+@item
+--default-character-set=... Set the default character set.
+@item
+-G, --enable-named-commands
+Named commands are enabled. Opposite to -g.
@item -e, --execute=...
Execute command and quit. (Output like with --batch)
@item -E, --vertical
Print the output of a query (rows) vertically. Without this option you
can also force this output by ending your statements with @code{\G}.
@item -f, --force
-Continue even if we get a SQL error.
+Continue even if we get an SQL error.
+@item
+-g, --no-named-commands
+Named commands are disabled. Use \* form only, or use named commands
+only in the beginning of a line ending with a semicolon (;) Since
+version 10.9 the client now starts with this option ENABLED by default!
+Disable with '-G'
@item -i, --ignore-space
Ignore space after function names.
@item -h, --host=...
@@ -25564,9 +25607,8 @@ Be more silent.
Socket file to use for connection.
@item -t --table
Output in table format. This is default in non-batch mode.
-@item -T, --exit-info
-Only used when debugging. --exit-info=0 will print some usage information
-on exit.
+@item -T, --debug-info
+Print some debug info at exit.
@item -u, --user=#
User for login if not current user.
@item -U, --safe-updates[=#], --i-am-a-dummy[=#]
@@ -28857,8 +28899,9 @@ sure that no other programs is using the dynamic libraries!
* Too many connections:: @code{Too many connections} error
* Out of memory:: @code{Out of memory} error
* Packet too large:: @code{Packet too large} error
-* Communication errors::
+* Communication errors:: Communication errors / Aborted connection
* Full table:: @code{The table is full} error
+* Cannot create::
* Commands out of sync:: @code{Commands out of sync} error in client
* Ignoring user:: @code{Ignoring user} error
* Cannot find table:: @code{Table 'xxx' doesn't exist} error
@@ -29134,7 +29177,7 @@ properly only by replacing hardware
@end itemize
@cindex The table is full
-@node Full table, Commands out of sync, Communication errors, Common errors
+@node Full table, Cannot create, Communication errors, Common errors
@subsection @code{The table is full} error
This error occurs in older @strong{MySQL} versions when an in-memory temporary
@@ -29151,8 +29194,31 @@ In @strong{MySQL} 3.23 in-memory temporary tables will automaticly be
converted to a disk based @code{MyISAM} table after the table size gets
bigger than @code{tmp_table_size}.
+@cindex Can't create/write to file
+@node Cannot create, Commands out of sync, Full table, Common errors
+@subsection @code{Can't create/write to file} error.
+
+If you get an error for some queries of type:
+
+@example
+Can't create/write to file '\\sqla3fe_0.ism'.
+@end example
+
+this means that @strong{MySQL} can't create a temporary file for the
+result set in the given temporary directory (the above error is a
+typical error message on windows, the unix error message is similar) .
+The fix is to start mysqld with @code{--tmpdir=path} or to add to your option
+file:
+
+@example
+[mysqld]
+tmpdir=C:/temp
+@end example
+
+assuming that the @file{c:\\temp} directory exists. @xref{Option files}.
+
@cindex Commands out of sync
-@node Commands out of sync, Ignoring user, Full table, Common errors
+@node Commands out of sync, Ignoring user, Cannot create, Common errors
@subsection @code{Commands out of sync} error in client
If you get @code{Commands out of sync; You can't run this command now}
@@ -29213,7 +29279,7 @@ in the current database with the name @code{xxx}.
Note that as @strong{MySQL} uses directories and files to store databases and
tables, the database and table names are @strong{case sensitive}!
-(On Win32 the databases and tables names are not case sensitive, but all
+(On Windows the databases and tables names are not case sensitive, but all
references to a given table within a query must use the same case!)
You can check which tables you have in the current database with
@@ -30123,6 +30189,15 @@ In your C or Perl programs, you can give the port and socket arguments
when connecting to the @strong{MySQL} server.
@item
+If your are using the @strong{MySQL} perl DBD module you can read the options
+from the @strong{MySQL} option files. @xref{Option files}.
+
+@example
+$dsn = "DBI:mysql:test;mysql_read_default_group=client;"
+$dbh = DBI->connect($dsn, $user, $password);
+@end example
+
+@item
@tindex MYSQL_UNIX_PORT environment variable
@tindex MYSQL_TCP_PORT environment variable
@tindex Environment variable, MYSQL_UNIX_PORT
@@ -32182,7 +32257,7 @@ example below.
The value of @code{host} may be either a hostname or an IP address. If
@code{host} is @code{NULL} or the string @code{"localhost"}, a connection to
the local host is assumed. If the OS supports sockets (Unix) or named pipes
-(Win32), they are used instead of TCP/IP to connect to the server.
+(Windows), they are used instead of TCP/IP to connect to the server.
@item
The @code{user} parameter contains the user's @strong{MySQL} login ID. If
@@ -32267,13 +32342,13 @@ use a very old client library to connect to a new server that wasn't started
with the @code{--old-protocol} option.
@item CR_NAMEDPIPEOPEN_ERROR;
-Failed to create a named pipe on Win32.
+Failed to create a named pipe on Windows.
@item CR_NAMEDPIPEWAIT_ERROR;
-Failed to wait for a named pipe on Win32.
+Failed to wait for a named pipe on Windows.
@item CR_NAMEDPIPESETSTATE_ERROR;
-Failed to get a pipe handler on Win32.
+Failed to get a pipe handler on Windows.
@end table
@subsubheading Example
@@ -33462,10 +33537,12 @@ You can also find this at:
@node Java, PHP, Eiffel, Clients
@section MySQL Java connectivity (JDBC)
-There are 2 supported JDBC drivers for @strong{MySQL} (the twz and mm driver).
-You can find a copy of these at @uref{http://www.mysql.com/Downloads/Contrib/}.
-For documentation consult any JDBC documentation and the
-drivers own documentation for @strong{MySQL} specific features.
+There are 2 supported JDBC drivers for @strong{MySQL} (the mm driver and
+the Reisin JDBC driver). You can find a copy of the mm driver at
+@uref{http://www.mysql.com/Downloads/Contrib/} and the Reisin driver at
+@uref{http://www.caucho.com/projects/jdbc-mysql/index.xtp} For
+documentation consult any JDBC documentation and the drivers own
+documentation for @strong{MySQL} specific features.
@node PHP, Cplusplus, Java, Clients
@section MySQL PHP API
@@ -33674,24 +33751,28 @@ of course.)
some added features.
@item JDBC (Java)
-@strong{MySQL} currently has 4 JDBC drivers:
+@strong{MySQL} currently has a lot of different JDBC drivers:
@itemize @bullet
@item
+The mm driver: A type 4 JDBC driver by Mark Matthews
+@email{mmatthew@@ecn.purdue.edu}. This is released under the LGPL.
+@item
+The Resin driver. This is a commercial JDBC driver released under open source.
+@uref{http://www.caucho.com/projects/jdbc-mysql/index.xtp}
+@item
The gwe driver: A Java interface by GWE technologies (not supported anymore).
@item
The jms driver: An improved gwe driver by Xiaokun Kelvin ZHU
-@email{X.Zhu@@brad.ac.uk}.
+@email{X.Zhu@@brad.ac.uk} (not supported anymore).
@item
The twz driver: A type 4 JDBC driver by Terrence W. Zellers
@email{zellert@@voicenet.com}. This is commercial but is free for private
-and educational use.
-@item
-The mm driver: A type 4 JDBC driver by Mark Matthews
-@email{mmatthew@@ecn.purdue.edu}. This is released under the GPL.
+and educational use (not supported anymore).
@end itemize
-The recommended drivers are the twz or mm driver. Both are reported to work
-excellently.
+The recommended driver is the mm driver. The Resin driver may also be
+good (at least the benchmarks looks good) but we haven't got that much
+information about this yet.
We know that @code{mSQL} has a JDBC driver, but we have too little experience
with it to compare.
@@ -34690,10 +34771,15 @@ The two drivers above have an LGPL
license. Please check @uref{http://www.worldserver.com/mm.mysql/} for
the latest drivers (and other JDBC information) because these drivers may be out of date.
+@item @uref{http://www.caucho.com/projects/jdbc-mysql/index.xtp}
+The Resin commercial JDBC driver which is released under open source.
+It claims to be faster than the mm driver, but we haven't got that much
+information about this yet.
+
@item @uref{http://www.mysql.com/Downloads/Contrib/twz1jdbcForMysql-1.0.4-GA.tar.gz, twz1jdbcForMysql-1.0.4-GA.tar.gz}
The twz driver: A type 4 JDBC driver by Terrence W. Zellers
@email{zellert@@voicenet.com}. This is commercial but is free for
-private and educational use.
+private and educational use. (not supported anymore)
@c no answer from server 990830
@c You can always find the latest driver at @uref{http://www.voicenet.com/~zellert/tjFM/}.
@item
@@ -34818,7 +34904,7 @@ You can always find the latest version
@uref{http://www.trash.net/~ffischer/admin/index.html, here}.
@item @uref{http://www.mysql.com/Downloads/Contrib/mysqlwinadmn.zip, mysqlwinadmn.zip}
-Win32 GUI (binary only) to administrate a database, by David B. Mansel,
+Windows GUI (binary only) to administrate a database, by David B. Mansel,
@email{david@@zhadum.org}.
@item @uref{http://www.mysql.com/Downloads/Contrib/netadmin.zip, netadmin.zip}
@@ -34832,12 +34918,12 @@ have still some bugs. you can test the program with all features. Please
send bugs and hints to Marco Suess @email{ms@@it-netservice.de}. Original
URL @url{http://www.it-netservice.de/pages/software/index.html}.
-@item @uref{http://www.mysql.com/Downloads/Win32/ARTADMIN201.EXE,Atronic's @strong{MySQL} client for Win32 2.0.1.0}.
+@item @uref{http://www.mysql.com/Downloads/Win32/ARTADMIN203.EXE,Atronic's @strong{MySQL} client for Windows 2.0.3.0}.
Home page for this can be found at: @uref{http://www.artronic.hr}.
@item @uref{http://www.mysql.com/Downloads/Win32/W9xstop.zip,Utility from Artronic to stop MySQL on win9x}
@item @uref{http://dbtools.vila.bol.com.br/, Dbtools}
-A tool to manage @strong{MySQL} databases. Currently only for Win32.
+A tool to manage @strong{MySQL} databases. Currently only for Windows.
Some features:
@itemize @bullet
@item manage servers, databases, tables, columns, indexes and users
@@ -34907,7 +34993,12 @@ A PHP3 tool in the spirit of mysql-webadmin, by Tobias Ratschiller, tobias@@dnet
@item @uref{http://www.mysql.com/Downloads/Contrib/useradm.tar.gz, useradm.tar.gz}
@strong{MySQL} administrator in PHP. By Ofni Thomas
@email{othomas@@vaidsystems.com}.
+
+@item @uref{http://gossamer-threads.com/perl/mysqlman/mysql.cgi, MySQLMan}
+Similar functionality as phpmyadmin, but written with perl and using
+html templates. By Alex Krohn.
@end itemize
+
@item @uref{http://www.mysql.com/Downloads/Contrib/mysql-editor.tar.gz,mysql-editor.tar.gz}
This cgi scripts in Perl enables you to edit content of Mysql
database. By Tomas Zeman.
@@ -34942,10 +35033,10 @@ programming! By Marc Beneteau, @email{marc@@odbsoft.com}.
@item @uref{http://www.mysql.com/Downloads/Contrib/sqlhtml.tar.gz, sqlhtml.tar.gz}
SQL/HTML is an HTML database manager for @strong{MySQL} using @code{DBI} 1.06.
-@item @uref{http://www.mysql.com/Downloads/Contrib/udmsearch-2.2.1b.tar.gz, UdmSearch 2.2.1b (stable version)}
-@item @uref{http://www.mysql.com/Downloads/Contrib/udmsearch-3.0.5.tar.gz, UdmSearch 3.0.5 (development version)}
+@item @uref{http://www.mysql.com/Downloads/Contrib/udmsearch-3.0.21.tar.gz, UdmSearch 3.0.21 (stable version)}
+@item @uref{http://www.mysql.com/Downloads/Contrib/udmsearch-3.1.3.tar.gz, UdmSearch 3.1.3 (development version)}
@item @uref{http://mysearch.udm.net, UdmSearch home page}
-A @strong{MySQL}- and PHP- based search engine over HTTP. By
+A SQL-based search engine for Internet. By
Alexander I. Barkov @email{bar@@izhcom.ru}.
@item @uref{http://www.mysql.com/Downloads/Contrib/wmtcl.doc, wmtcl.doc}
@@ -35051,7 +35142,7 @@ Boekhold, @email{boekhold@@cindy.et.tudelft.nl}, and Michael Widenius.
This converter can't handle MEMO fields.
@item @uref{http://www.mysql.com/Downloads/Contrib/dbf2mysql.zip, dbf2mysql.zip}
-Convert between FoxPro @file{.dbf} files and @strong{MySQL} tables on Win32.
+Convert between FoxPro @file{.dbf} files and @strong{MySQL} tables on Windows.
By Alexander Eltsyn, @email{ae@@nica.ru} or @email{ae@@usa.net}.
@item @uref{http://www.mysql.com/Downloads/Contrib/dump2h-1.20.gz, dump2h-1.20.gz}
@@ -35570,6 +35661,27 @@ though, so 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.23
@itemize @bullet
@item
+@strong{MySQL} client 'mysql' now starts with option --no-named-commands
+(-g) by default. This option can be disabled with --enable-named-commands
+(-G). This may cause incompatibility problems in some cases, for example
+in SQL scripts that use named commands without a semicolon, etc. !
+@item
+Fixed a problem when using many pending @code{DROP TABLE} statement at
+the same time.
+@item
+Optimizer didn't use keys properly when using @code{LEFT JOIN} on an
+empty table.
+@item
+Added shorter help text when invoking @code{mysqld} with wrong options.
+@item
+Fixed not fatal @code{free()} bug in mysqlimport.
+@item
+Fixed bug in @code{MyISAM} index handling of
+@code{DECIMAL}/@code{NUMERIC} keys.
+@item
+Fixed a bug in concurrent insert in @code{MyISAM} tables; In some context
+usage of @code{MIN(key_part)} or @code{MAX(key_part)} returned an empty set.
+@item
Updated mysqlhotcopy to use the new @code{FLUSH TABLES table_list} syntax. Only
tables which are being backed up are flushed now.
@item
@@ -35605,6 +35717,8 @@ 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
always deleted.
@item
+Fixed bug in range optimizer for HEAP tables when one did search on part index.
+@item
Fixed that @code{SELECT} on part keys works with BDB tables.
@item
Fixed that @code{INSERT INTO bdb_table ... SELECT} works with BDB tables.
@@ -35819,7 +35933,7 @@ Fixed that @code{USE INDEX} works with @code{PRIMARY} keys.
@item
Added @code{BEGIN} statement to start a transaction in @code{AUTOCOMMIT} mode.
@item
-Added symbolic links support for Win32.
+Added symbolic links support for Windows.
@item
Changed protocol to let client know if the server is in AUTOCOMMIT mode
and if there is a pending transaction. If there is a pending transaction
@@ -36564,7 +36678,8 @@ in scientific notation (1.0 E+10) when retrieved.
@code{REPLACE} is now faster than before.
@item
Changed @code{LIKE} character comparison to behave as @code{=};
-This means that @code{'e' LIKE '@'e'} is now true.
+This means that @code{'e' LIKE '@'e'} (if the line doesn't display
+correctly, the latter 'e' means a French 'e' with a dot above) is now true.
@item
@code{SHOW TABLE STATUS} returns a lot of information about the tables.
@item
@@ -36793,7 +36908,7 @@ packed indexes.
@itemize @bullet
@item
-A few small fixes for the Win32 version.
+A few small fixes for the Windows version.
@end itemize
@@ -36867,7 +36982,7 @@ Some configure issues to fix problems with big file system detection.
@item
Fixed problem when sorting on big blob columns.
@item
-@code{ROUND()} will now work on Win32.
+@code{ROUND()} will now work on Windows.
@end itemize
@node News-3.22.26, News-3.22.25, News-3.22.27, News-3.22.x
@@ -36918,7 +37033,7 @@ Fixed bug when using @code{LOCK TABLES table_name READ; FLUSH TABLES;}
@item
Applied some patches for HP-UX.
@item
-@code{isamchk} should now work on Win32.
+@code{isamchk} should now work on Windows.
@item
Changed @file{configure} to not use big file handling on Linux as this
crashes some RedHat 6.0 systems
@@ -36970,10 +37085,10 @@ Added patches for DEC 3.2 and SCO.
@item
Fixed path-bug when installing @strong{MySQL} as a service on NT.
@item
-The @strong{MySQL}-Win32 version is now compiled with VC++ 6.0 instead of
+The @strong{MySQL}-Windows version is now compiled with VC++ 6.0 instead of
with VC++ 5.0.
@item
-New installation setup for @strong{MySQL}-Win32.
+New installation setup for @strong{MySQL}-Windows.
@end itemize
@node News-3.22.21, News-3.22.20, News-3.22.22, News-3.22.x
@@ -37034,7 +37149,7 @@ Fixes a fatal problem in 3.22.17 on Linux; After @code{shutdown}
all threads didn't die properly.
@item
Added option @code{-O flush_time=#} to @code{mysqld}. This is mostly
-useful on Win32 and tells how often @strong{MySQL} should close all
+useful on Windows and tells how often @strong{MySQL} should close all
unused tables and flush all updated tables to disk.
@item
Fixed problem that a @code{VARCHAR} column compared with @code{CHAR} column
@@ -37131,14 +37246,14 @@ value in the update log.
Fixed lock handler bug when one did
@code{INSERT INTO TABLE ... SELECT ... GROUP BY}.
@item
-Added a patch for @code{localtime_r()} on Win32 so that it will not crash
+Added a patch for @code{localtime_r()} on Windows so that it will not crash
anymore if your date is > 2039, but instead will return a time of all zero.
@item
Names for
user-defined functions are no longer case sensitive.
@item
Added escape of @code{^Z} (ASCII 26) to @code{\Z} as @code{^Z} doesn't
-work with pipes on Win32.
+work with pipes on Windows.
@item
@code{mysql_fix_privileges} adds a new column to the @code{mysql.func} to
support aggregate UDF functions in future @strong{MySQL} releases.
@@ -37157,8 +37272,8 @@ column didn't work.
Updated @file{config.guess} to allow @strong{MySQL} to configure on
UnixWare 7.0.x.
@item
-Changed the implementation of @code{pthread_cond()} on the Win32 version.
-@code{get_lock()} now correctly times out on Win32!
+Changed the implementation of @code{pthread_cond()} on the Windows version.
+@code{get_lock()} now correctly times out on Windows!
@end itemize
@node News-3.22.12, News-3.22.11, News-3.22.13, News-3.22.x
@@ -37329,7 +37444,7 @@ Added @code{ESCAPE} option to @code{LIKE}.
@item
Added a lot more output to @code{mysqladmin debug}.
@item
-You can now start @code{mysqld} on Win32 with the @code{--flush} option.
+You can now start @code{mysqld} on Windows with the @code{--flush} option.
This will flush all tables to disk after each update. This makes things
much safer on NT/Win98 but also @strong{MUCH} slower.
@end itemize
@@ -37360,7 +37475,7 @@ Fixed a big problem with @code{OPTIMIZE TABLE}.
@strong{MySQL} clients on NT will now by default first try to connect with
named pipes and after this with TCP/IP.
@item
-Fixed a problem with @code{DROP TABLE} and @code{mysqladmin shutdown} on Win32
+Fixed a problem with @code{DROP TABLE} and @code{mysqladmin shutdown} on Windows
(a fatal bug from 3.22.6).
@item
Fixed problems with @code{TIME columns} and negative strings.
@@ -37588,14 +37703,14 @@ delete rows from the table.
Added optimization to remove const reference tables from @code{ORDER BY} and
@code{GROUP BY}.
@item
-@code{mysqld} now automatically disables system locking on Linux and Win32,
+@code{mysqld} now automatically disables system locking on Linux and Windows,
and for systems that use MIT-pthreads. You can force the use of locking
with the @code{--enable-locking} option.
@item
Added @code{--console} option to @code{mysqld}, to force a console window
-(for error messages) when using Win32.
+(for error messages) when using Windows.
@item
-Fixed table locks for Win32.
+Fixed table locks for Windows.
@item
Allow @samp{$} in identifiers.
@item
@@ -38134,10 +38249,10 @@ A lot of small changes to the binary releases.
@item
Fixed a bug in the new protocol from @strong{MySQL} 3.21.20.
@item
-Changed @code{ALTER TABLE} to work with Win32 (Win32 can't rename open files).
-Also fixed a couple of small bugs in the Win32 version.
+Changed @code{ALTER TABLE} to work with Windows (Windows can't rename
+open files). Also fixed a couple of small bugs in the Windows version.
@item
-All standard @strong{MySQL} clients are now ported to @strong{MySQL}-Win32.
+All standard @strong{MySQL} clients are now ported to @strong{MySQL}-Windows.
@item
@strong{MySQL} can now be started as a service on NT.
@end itemize
@@ -39847,7 +39962,13 @@ should be implemented.
@item
Add support for UNICODE.
@item
-@code{NATURAL JOIN}.
+@code{NATURAL JOIN} and @code{UNION JOIN}
+@item
+Allow @code{select a from crash_me left join crash_me2 using (a)}; In this
+case a is assumed to come from the crash_me table.
+@item
+Fix that @code{ON} and @code{USING} works with the @code{JOIN} and
+@code{INNER JOIN} join types.
@item
Oracle like @code{CONNECT BY PRIOR ...} to search hierarchy structures.
@item
@@ -39858,6 +39979,8 @@ added to @code{mysqld}
@item
Processlist should show number of queries/thread.
@item
+@code{SHOW HOSTS} for printing information about the hostname cache.
+@item
@code{DELETE} and @code{REPLACE} options to the @code{UPDATE} statement
(this will delete rows when one gets a dupplicate key error while updating).
@item
@@ -39877,9 +40000,6 @@ one (The GNU library should be much faster than the old one).
Change that @code{ALTER TABLE} doesn't abort clients that executes
@code{INSERT DELAYED}.
@item
-Allow @code{select a from crash_me left join crash_me2 using (a)}; In this
-case a is assumed to come from the crash_me table.
-@item
Fix that when columns referenced in an @code{UPDATE} clause contains the old
values before the update started.
@item
@@ -39903,6 +40023,14 @@ 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.
+@item
+Fix that the type for @code{MAX(column)} is the same as the column type.
+@example
+create table t1 (a DATE);
+insert into t1 values (now());
+create table t2 select max(a) from t1;
+show columns from t2;
+@end example
@end itemize
@node TODO sometime, TODO unplanned, TODO future, TODO
diff --git a/client/mysql.cc b/client/mysql.cc
index 987f70dee5d..9dac9a7694c 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -114,7 +114,7 @@ static bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
no_rehash=0,skip_updates=0,safe_updates=0,one_database=0,
opt_compress=0,
vertical=0,skip_line_numbers=0,skip_column_names=0,opt_html=0,
- no_named_cmds=0;
+ no_named_cmds=1; // we want this to be the default
static uint verbose=0,opt_silent=0,opt_mysql_port=0;
static my_string opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE;
@@ -160,7 +160,7 @@ typedef struct {
static COMMANDS commands[] = {
{ "help", 'h', com_help, 0, "Display this text" },
- { "?", 'h', com_help, 0, "Synonym for `help'" },
+ { "?", '?', com_help, 0, "Synonym for `help'" },
{ "clear", 'c', com_clear, 0, "Clear command"},
{ "connect",'r', com_connect,1,
"Reconnect to the server. Optional arguments are db and host" },
@@ -300,7 +300,7 @@ int main(int argc,char *argv[])
}
}
#endif
- sprintf(buff, "Type '%s' for help.\n", no_named_cmds ? "\\h" : "help");
+ sprintf(buff, "Type 'help;' or '\\h' for help.\n");
put_info(buff,INFO_INFO);
status.exit_status=read_lines(1); // read lines and execute them
mysql_end(0);
@@ -352,6 +352,7 @@ static struct option long_options[] =
{"database", required_argument, 0, 'D'},
{"debug-info", no_argument, 0, 'T'},
{"default-character-set", required_argument, 0, OPT_DEFAULT_CHARSET},
+ {"enable-named-commands", no_argument, 0, 'G'},
{"execute", required_argument, 0, 'e'},
{"force", no_argument, 0, 'f'},
{"help", no_argument, 0, '?'},
@@ -401,7 +402,7 @@ CHANGEABLE_VAR changeable_vars[] = {
static void usage(int version)
{
- printf("%s Ver 10.8 Distrib %s, for %s (%s)\n",
+ printf("%s Ver 10.10 Distrib %s, for %s (%s)\n",
my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
if (version)
return;
@@ -426,11 +427,17 @@ static void usage(int version)
-D, --database=.. Database to use.\n\
--default-character-set=...\n\
Set the default character set.\n\
+ -G, --enable-named-commands\n\
+ Named commands are enabled. Opposite to -g.\n\
-e, --execute=... Execute command and quit. (Output like with --batch)\n\
-E, --vertical Print the output of a query (rows) vertically.\n\
-f, --force Continue even if we get an sql error.\n\
-g, --no-named-commands\n\
- Named commands are disabled. Use \\* form only.\n\
+ Named commands are disabled. Use \\* form only, or\n\
+ use named commands only in the beginning of a line\n\
+ ending with a semicolon (;)\n\
+ Since version 10.9 the client now starts with this\n\
+ option ENABLED by default! Disable with '-G'\n\
-i, --ignore-space Ignore space after function names.\n\
-h, --host=... Connect to host.\n\
-H, --html Produce HTML output.\n\
@@ -486,7 +493,7 @@ static int get_options(int argc, char **argv)
bool tty_password=0;
set_all_changeable_vars(changeable_vars);
- while ((c=getopt_long(argc,argv,"?ABCD:LfgHinNoqrstTUvVwWEe:h:O:P:S:u:#::p::",
+ while ((c=getopt_long(argc,argv,"?ABCD:LfgGHinNoqrstTUvVwWEe:h:O:P:S:u:#::p::",
long_options, &option_index)) != EOF)
{
switch(c) {
@@ -565,6 +572,7 @@ static int get_options(int argc, char **argv)
case 'E': vertical=1; break;
case 'w': wait_flag=1; break;
case 'A': no_rehash=1; break;
+ case 'G': no_named_cmds=0; break;
case 'g': no_named_cmds=1; break;
case 'H': opt_html=1; break;
case 'i': connect_flag|= CLIENT_IGNORE_SPACE; break;
@@ -1171,11 +1179,13 @@ com_help (String *buffer __attribute__((unused)),
reg1 int i;
put_info("\nMySQL commands:",INFO_INFO);
+ if (no_named_cmds)
+ put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
for (i = 0; commands[i].name; i++)
{
if (commands[i].func)
- printf("%s\t(\\%c)\t%s\n", commands[i].name,commands[i].cmd_char,
- commands[i].doc);
+ printf("%s\t(\\%c)\t%s\n", commands[i].name,
+ commands[i].cmd_char, commands[i].doc);
}
if (connected)
printf("\nConnection id: %ld (Can be used with mysqladmin kill)\n\n",
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 0a69f18c176..596b68591b7 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -25,7 +25,7 @@
** * *
** *************************
*/
-#define IMPORT_VERSION "2.3"
+#define IMPORT_VERSION "2.4"
#include <global.h>
#include <my_sys.h>
@@ -514,7 +514,6 @@ int main(int argc, char **argv)
exitcode = error;
db_disconnect(current_host, sock);
my_free(password,MYF(MY_ALLOW_ZERO_PTR));
- my_free(current_user,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(argv_to_free);
my_end(0);
return(exitcode);
diff --git a/include/config-win.h b/include/config-win.h
index dc54895a5d9..a0008675d49 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -250,6 +250,8 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_RINT /* defined in this file */
#define NO_FCNTL_NONBLOCK /* No FCNTL */
#define HAVE_ALLOCA
+#define HAVE_STRPBRK
+#define HAVE_STRSTR
#define HAVE_COMPRESS
#ifdef NOT_USED
diff --git a/include/global.h b/include/global.h
index 27a7c54ede0..6ad6b068b98 100644
--- a/include/global.h
+++ b/include/global.h
@@ -110,7 +110,7 @@
#endif
/* In Linux-alpha we have atomic.h if we are using gcc */
-#if defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__alpha__) && (__GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95))
+#if defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__alpha__) && (__GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95)) && !defined(HAVE_ATOMIC_ADD)
#define HAVE_ATOMIC_ADD
#define HAVE_ATOMIC_SUB
#endif
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 4049b1efa6d..8552d386e5e 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -112,7 +112,8 @@ static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
* Base version coded by Steve Bernacki, Jr. <steve@navinet.net>
*****************************************************************************/
-static int connect2(File s, const struct sockaddr *name, uint namelen, uint to)
+static int connect2(my_socket s, const struct sockaddr *name, uint namelen,
+ uint to)
{
#if defined(__WIN__)
return connect(s, (struct sockaddr*) name, namelen);
@@ -1138,7 +1139,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
uint port, const char *unix_socket,uint client_flag)
{
char buff[100],charset_name_buff[16],*end,*host_info, *charset_name;
- int sock;
+ my_socket sock;
uint32 ip_addr;
struct sockaddr_in sock_addr;
uint pkt_length;
@@ -1270,7 +1271,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host);
DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port));
/* _WIN64 ; Assume that the (int) range is enough for socket() */
- if ((sock = (int) socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR)
+ if ((sock = (my_socket) socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR)
{
net->last_errno=CR_IPSOCK_ERROR;
sprintf(net->last_error,ER(net->last_errno),ERRNO);
diff --git a/myisam/ChangeLog b/myisam/ChangeLog
index e7950684f56..d212039fedf 100644
--- a/myisam/ChangeLog
+++ b/myisam/ChangeLog
@@ -1,3 +1,7 @@
+2000-08-23 Michael Widenius <monty@mysql.com>
+
+* Fixed bug when comparing DECIMAL/NUMERIC key parts.
+
2000-08-17 Michael Widenius <monty@mysql.com>
* Add a new flag in share.staus so that we can quickly check if a table
diff --git a/myisam/Makefile.am b/myisam/Makefile.am
index 6c5767640c8..aff1b670f33 100644
--- a/myisam/Makefile.am
+++ b/myisam/Makefile.am
@@ -43,7 +43,7 @@ libmyisam_a_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.c \
mi_rsamepos.c mi_panic.c mi_close.c mi_create.c\
mi_range.c mi_dbug.c mi_checksum.c mi_log.c \
mi_changed.c mi_static.c mi_delete_all.c \
- mi_delete_table.c mi_rename.c mi_check.c \
+ mi_delete_table.c mi_rename.c mi_check.c mi_debug.c \
ft_parser.c ft_search.c ft_stopwords.c ft_static.c \
ft_update.c sort.c
CLEANFILES = test?.IS? isam.log mi_test_all
diff --git a/myisam/ft_stopwords.c b/myisam/ft_stopwords.c
index f8fddc9d4bb..4c13a845b42 100644
--- a/myisam/ft_stopwords.c
+++ b/myisam/ft_stopwords.c
@@ -48,7 +48,7 @@ int ft_init_stopwords(const char **sws)
for(;*sws;sws++)
{
- if( (sw.len=strlen(sw.pos=*sws)) < MIN_WORD_LEN) continue;
+ if( (sw.len= (uint) strlen(sw.pos=*sws)) < MIN_WORD_LEN) continue;
if(!tree_insert(stopwords3, &sw, 0))
{
delete_tree(stopwords3);
diff --git a/myisam/mi_delete_table.c b/myisam/mi_delete_table.c
index 916f5a8fc02..360956ad110 100644
--- a/myisam/mi_delete_table.c
+++ b/myisam/mi_delete_table.c
@@ -30,6 +30,10 @@ int mi_delete_table(const char *name)
uint raid_type=0,raid_chunks=0;
#endif
DBUG_ENTER("mi_delete_table");
+
+#ifdef EXTRA_DEBUG
+ check_table_is_closed(name,"delete");
+#endif
#ifdef USE_RAID
{
MI_INFO *info;
@@ -39,7 +43,10 @@ int mi_delete_table(const char *name)
raid_chunks = info->s->base.raid_chunks;
mi_close(info);
}
+#ifdef EXTRA_DEBUG
+ check_table_is_closed(name,"delete");
#endif
+#endif /* USE_RAID */
fn_format(from,name,"",MI_NAME_IEXT,4);
if (my_delete(from, MYF(MY_WME)))
diff --git a/myisam/mi_rename.c b/myisam/mi_rename.c
index 6849e1c3d26..5c92db3f7ce 100644
--- a/myisam/mi_rename.c
+++ b/myisam/mi_rename.c
@@ -30,6 +30,11 @@ int mi_rename(const char *old_name, const char *new_name)
uint raid_type=0,raid_chunks=0;
#endif
DBUG_ENTER("mi_rename");
+
+#ifdef EXTRA_DEBUG
+ check_table_is_closed(old_name,"rename old_table");
+ check_table_is_closed(new_name,"rename new table2");
+#endif
#ifdef USE_RAID
{
MI_INFO *info;
@@ -39,7 +44,10 @@ int mi_rename(const char *old_name, const char *new_name)
raid_chunks = info->s->base.raid_chunks;
mi_close(info);
}
+#ifdef EXTRA_DEBUG
+ check_table_is_closed(old_name,"rename raidcheck");
#endif
+#endif /* USE_RAID */
fn_format(from,old_name,"",MI_NAME_IEXT,4);
fn_format(to,new_name,"",MI_NAME_IEXT,4);
diff --git a/myisam/mi_rnext.c b/myisam/mi_rnext.c
index 0dc40d0257f..f7e7b61d934 100644
--- a/myisam/mi_rnext.c
+++ b/myisam/mi_rnext.c
@@ -57,7 +57,7 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
/* Skip rows that are inserted by other threads since we got a lock */
if ((error=_mi_search_next(info,info->s->keyinfo+inx,info->lastkey,
info->lastkey_length,
- flag,
+ SEARCH_BIGGER,
info->s->state.key_root[inx])))
break;
}
diff --git a/myisam/mi_rprev.c b/myisam/mi_rprev.c
index 6a75cc0daa6..471eecc33f5 100644
--- a/myisam/mi_rprev.c
+++ b/myisam/mi_rprev.c
@@ -58,7 +58,7 @@ int mi_rprev(MI_INFO *info, byte *buf, int inx)
/* Skip rows that are inserted by other threads since we got a lock */
if ((error=_mi_search_next(info,share->keyinfo+inx,info->lastkey,
info->lastkey_length,
- flag,
+ SEARCH_SMALLER,
share->state.key_root[inx])))
break;
}
diff --git a/myisam/mi_search.c b/myisam/mi_search.c
index 812982082af..8fb35f3af65 100644
--- a/myisam/mi_search.c
+++ b/myisam/mi_search.c
@@ -716,6 +716,7 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a,
{
alength= *a++; blength= *b++;
end=a+alength;
+ next_key_length=key_length-blength-1;
}
else
{
diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h
index d0774feaa9d..cd1eaa76ce1 100644
--- a/myisam/myisamdef.h
+++ b/myisam/myisamdef.h
@@ -622,6 +622,8 @@ void mi_dectivate_non_unique_index(MI_INFO *info, ha_rows rows);
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);
+my_bool check_table_is_closed(const char *name, const char *where);
+
/* Functions needed by mi_check */
#ifdef __cplusplus
extern "C" {
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 65d259a5307..a68df18c41a 100755
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -48,7 +48,7 @@ rm $BASE/include/Makefile*; rm $BASE/include/*.in
cp -p tests/*.res tests/*.tst tests/*.pl $BASE/tests
cp -p support-files/* $BASE/support-files
-cp -p libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a $BASE/lib
+cp -p libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_a.a libmysql_r/.libs/libmysqlclient.so* libmysql_r/libmysqlclient.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a $BASE/lib
cp -r -p sql/share/* $BASE/share/mysql; rm -f $BASE/share/mysql/Makefile* $BASE/share/mysql/*/*.OLD $BASE/share/CVS $BASE/share/*/CVS
cp -p scripts/* $BASE/bin
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index 989497cee6e..591ca0bc813 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -251,6 +251,21 @@ int ha_heap::rename_table(const char * from, const char * to)
}
+ha_rows ha_heap::records_in_range(int inx,
+ const byte *start_key,uint start_key_len,
+ enum ha_rkey_function start_search_flag,
+ const byte *end_key,uint end_key_len,
+ enum ha_rkey_function end_search_flag)
+{
+ KEY *pos=table->key_info+inx;
+ if (start_key_len != end_key_len ||
+ start_key_len != pos->key_length ||
+ start_search_flag != HA_READ_KEY_EXACT ||
+ end_search_flag != HA_READ_KEY_EXACT)
+ return HA_POS_ERROR; // Can't only use exact keys
+ return 10; // Good guess
+}
+
/* We can just delete the heap on creation */
int ha_heap::create(const char *name, TABLE *form, HA_CREATE_INFO *create_info)
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index acbc0975f1e..b56ee84822f 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -65,7 +65,10 @@ class ha_heap: public handler
int reset(void);
int external_lock(THD *thd, int lock_type);
int delete_all_rows(void);
-
+ ha_rows records_in_range(int inx, const byte *start_key,uint start_key_len,
+ enum ha_rkey_function start_search_flag,
+ const byte *end_key,uint end_key_len,
+ enum ha_rkey_function end_search_flag);
int delete_table(const char *from);
int rename_table(const char * from, const char * to);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
diff --git a/sql/handler.cc b/sql/handler.cc
index 592861e176b..437b11be5bb 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -317,8 +317,8 @@ int handler::ha_open(const char *name, int mode, int test_if_locked)
}
if (!error)
{
-
- if (!(ref=(byte*) my_malloc(ALIGN_SIZE(ref_length)*2,MYF(0))))
+ if (!(ref=(byte*) alloc_root(&table->mem_root,
+ ALIGN_SIZE(ref_length)*2)))
{
close();
error=HA_ERR_OUT_OF_MEM;
diff --git a/sql/handler.h b/sql/handler.h
index 67fd99c71d7..08bf355b60e 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -200,7 +200,7 @@ public:
create_time(0), check_time(0), update_time(0), mean_rec_length(0),
ft_handler(0)
{}
- virtual ~handler(void) { my_free((char*) ref,MYF(MY_ALLOW_ZERO_PTR)); }
+ virtual ~handler(void) {}
int ha_open(const char *name, int mode, int test_if_locked);
void update_timestamp(byte *record);
void update_auto_increment();
diff --git a/sql/lock.cc b/sql/lock.cc
index a2e4daa4590..eba1851bae0 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -407,15 +407,17 @@ 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;
+ DBUG_ENTER("lock_table_name");
+
+ 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;
+ DBUG_RETURN(0);
/* Create a table entry with the right key and with an old refresh version */
/* Note that we must use my_malloc() here as this is freed by the table
@@ -423,17 +425,18 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
if (!(table= (TABLE*) my_malloc(sizeof(*table)+key_length,
MYF(MY_WME | MY_ZEROFILL))))
- return -1;
+ DBUG_RETURN(-1);
memcpy((table->table_cache_key= (char*) (table+1)), key, key_length);
table->key_length=key_length;
table->in_use=thd;
+ table->locked_by_name=1;
table_list->table=table;
if (hash_insert(&open_cache, (byte*) table))
- return -1;
+ DBUG_RETURN(-1);
if (remove_table_from_cache(thd, table_list->db, table_list->name))
- return 1; // Table is in use
- return 0;
+ DBUG_RETURN(1); // Table is in use
+ DBUG_RETURN(0);
}
void unlock_table_name(THD *thd, TABLE_LIST *table_list)
@@ -446,7 +449,7 @@ 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))
+ if (table_list->table && table_is_used(table_list->table,0))
return 1;
}
return 0; // All tables are locked
@@ -456,6 +459,7 @@ static bool locked_named_table(THD *thd, TABLE_LIST *table_list)
bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list)
{
bool result=0;
+ DBUG_ENTER("wait_for_locked_table_names");
while (locked_named_table(thd,table_list))
{
@@ -467,5 +471,5 @@ bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list)
wait_for_refresh(thd);
pthread_mutex_lock(&LOCK_open);
}
- return result;
+ DBUG_RETURN(result);
}
diff --git a/sql/mini_client.cc b/sql/mini_client.cc
index b9e66911475..90024f1ff47 100644
--- a/sql/mini_client.cc
+++ b/sql/mini_client.cc
@@ -225,7 +225,8 @@ static void mc_free_old_query(MYSQL *mysql)
* Base version coded by Steve Bernacki, Jr. <steve@navinet.net>
*****************************************************************************/
-static int mc_sock_connect(File s, const struct sockaddr *name, uint namelen, uint to)
+static int mc_sock_connect(my_socket s, const struct sockaddr *name,
+ uint namelen, uint to)
{
#if defined(__WIN__)
return connect(s, (struct sockaddr*) name, namelen);
@@ -451,7 +452,7 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
uint port, const char *unix_socket,uint client_flag)
{
char buff[100],*end,*host_info;
- int sock;
+ my_socket sock;
ulong ip_addr;
struct sockaddr_in sock_addr;
uint pkt_length;
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index fa61102fb57..7e3186defd3 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -319,10 +319,11 @@ TABLE *open_table(THD *thd,const char *db,const char *table,const char *alias,
TABLE *find_locked_table(THD *thd, const char *db,const char *table_name);
bool reopen_table(TABLE *table,bool locked=0);
bool reopen_tables(THD *thd,bool get_locks,bool in_refresh);
-void close_old_data_files(THD *thd, TABLE *table, bool abort_locks);
+void close_old_data_files(THD *thd, TABLE *table, bool abort_locks,
+ bool send_refresh);
bool close_data_tables(THD *thd,const char *db, const char *table_name);
bool wait_for_tables(THD *thd);
-bool table_is_used(TABLE *table);
+bool table_is_used(TABLE *table, bool wait_for_name_lock);
bool drop_locked_tables(THD *thd,const char *db, const char *table_name);
void abort_locked_tables(THD *thd,const char *db, const char *table_name);
Field *find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index f8ce60b9681..2a7a0575fad 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2407,6 +2407,12 @@ static void print_version(void)
server_version,SYSTEM_TYPE,MACHINE_TYPE);
}
+static void use_help(void)
+{
+ print_version();
+ printf("Use %s --help for a list of available options\n",my_progname);
+}
+
static void usage(void)
{
print_version();
@@ -2621,7 +2627,7 @@ static void get_options(int argc,char **argv)
case 'O':
if (set_changeable_var(optarg, changeable_vars))
{
- usage();
+ use_help();
exit(1);
}
break;
@@ -2666,7 +2672,8 @@ static void get_options(int argc,char **argv)
opt_noacl=1;
else
{
- usage();
+ fprintf(stderr,"%s: Unrecognized option: %s\n",my_progname,optarg);
+ use_help();
exit(1);
}
break;
@@ -2910,7 +2917,7 @@ static void get_options(int argc,char **argv)
default:
fprintf(stderr,"%s: Unrecognized option: %c\n",my_progname,c);
- usage();
+ use_help();
exit(1);
}
}
@@ -2920,7 +2927,7 @@ static void get_options(int argc,char **argv)
if (argc != optind)
{
fprintf(stderr,"%s: Too many parameters\n",my_progname);
- usage();
+ use_help();
exit(1);
}
fix_paths();
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 4f1abf9b685..25ee26dbdbd 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -14,6 +14,16 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/*
+ TODO:
+ Fix that MAYBE_KEY are stored in the tree so that we can detect use
+ of full hash keys for queries like:
+
+ select s.id, kws.keyword_id from sites as s,kws where s.id=kws.site_id and kws.keyword_id in (204,205);
+
+*/
+
+
#ifdef __GNUC__
#pragma implementation // gcc: Class implementation
@@ -557,7 +567,7 @@ SEL_ARG *SEL_ARG::clone_tree()
** Returns:
** -1 if impossible select
** 0 if can't use quick_select
-** 1 if found usably range
+** 1 if found usable range
** Updates the following in the select parameter:
** needed_reg ; Bits for keys with may be used if all prev regs are read
** quick ; Parameter to use when reading records.
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 6bf44f7d7d6..de689baaddb 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -582,9 +582,8 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
thd->mysys_var->current_cond= &COND_refresh;
thd->proc_info="Flushing tables";
pthread_mutex_unlock(&thd->mysys_var->mutex);
- VOID(pthread_cond_broadcast(&COND_refresh)); // If one flush is locked
- close_old_data_files(thd,thd->open_tables,1);
+ close_old_data_files(thd,thd->open_tables,1,1);
bool found=1;
/* Wait until all threads has closed all the tables we had locked */
DBUG_PRINT("info", ("Waiting for others threads to close their open tables"));
@@ -921,7 +920,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
** There is a refresh in progress for this table
** Wait until the table is freed or the thread is killed.
*/
- close_old_data_files(thd,thd->open_tables,0);
+ close_old_data_files(thd,thd->open_tables,0,0);
if (table->in_use != thd)
wait_for_refresh(thd);
else
@@ -1216,9 +1215,11 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh)
abort_locks is set if called from flush_tables.
*/
-void close_old_data_files(THD *thd, TABLE *table, bool abort_locks)
+void close_old_data_files(THD *thd, TABLE *table, bool abort_locks,
+ bool send_refresh)
{
- bool found=0;
+ DBUG_ENTER("close_old_data_files");
+ bool found=send_refresh;
for (; table ; table=table->next)
{
if (table->version != refresh_version)
@@ -1241,6 +1242,7 @@ void close_old_data_files(THD *thd, TABLE *table, bool abort_locks)
}
if (found)
VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh
+ DBUG_VOID_RETURN;
}
@@ -1250,17 +1252,19 @@ void close_old_data_files(THD *thd, TABLE *table, bool abort_locks)
if the table is closed
*/
-bool table_is_used(TABLE *table)
+bool table_is_used(TABLE *table, bool wait_for_name_lock)
{
do
{
char *key= table->table_cache_key;
uint key_length=table->key_length;
- for (TABLE *search=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ;
+ for (TABLE *search=(TABLE*) hash_search(&open_cache,
+ (byte*) key,key_length) ;
search ;
search = (TABLE*) hash_next(&open_cache,(byte*) key,key_length))
{
if (search->locked_by_flush ||
+ search->locked_by_name && wait_for_name_lock ||
search->db_stat && search->version < refresh_version)
return 1; // Table is used
}
@@ -1278,19 +1282,14 @@ bool wait_for_tables(THD *thd)
thd->proc_info="Waiting for tables";
pthread_mutex_lock(&LOCK_open);
- thd->some_tables_deleted=0;
- close_old_data_files(thd,thd->open_tables,0);
- if (dropping_tables)
- {
- (void) pthread_cond_broadcast(&COND_refresh); // Signal to refresh/delete
- (void) pthread_cond_wait(&COND_refresh,&LOCK_open);
- }
-
- while (table_is_used(thd->open_tables) && ! thd->killed)
+ while (!thd->killed)
{
- (void) pthread_cond_wait(&COND_refresh,&LOCK_open);
+ thd->some_tables_deleted=0;
+ close_old_data_files(thd,thd->open_tables,0,dropping_tables != 0);
+ if (!table_is_used(thd->open_tables,1))
+ break;
+ (void) pthread_cond_wait(&COND_refresh,&LOCK_open);
}
-
if (thd->killed)
result= 1; // aborted
else
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 8b7e16709c0..97e67127fd0 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1170,9 +1170,8 @@ mysql_execute_command(void)
#endif
case SQLCOM_REPAIR:
{
- if (!tables->db)
- tables->db=thd->db;
- if (check_table_access(thd,SELECT_ACL | INSERT_ACL, tables))
+ if (check_db_used(thd,tables) ||
+ check_table_access(thd,SELECT_ACL | INSERT_ACL, tables))
goto error; /* purecov: inspected */
res = mysql_repair_table(thd, tables, &lex->check_opt);
break;
@@ -1695,6 +1694,10 @@ error:
** Get the user (global) and database privileges for all used tables
** Returns true (error) if we can't get the privileges and we don't use
** table/column grants.
+** The idea of EXTRA_ACL is that one will be granted access to the table if
+** one has the asked privilege on any column combination of the table; For
+** example to be able to check a table one needs to have SELECT privilege on
+** any column of the table.
****************************************************************************/
bool
@@ -1760,7 +1763,8 @@ check_table_access(THD *thd,uint want_access,TABLE_LIST *tables)
TABLE_LIST *org_tables=tables;
for (; tables ; tables=tables->next)
{
- if ((thd->master_access & want_access) == want_access && thd->db)
+ if ((thd->master_access & want_access) == (want_access & ~EXTRA_ACL) &&
+ thd->db)
tables->grant.privilege= want_access;
else if (tables->db && tables->db == thd->db)
{
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6578e3b717a..8bc8091f42a 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -800,6 +800,14 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
if ((s->on_expr=tables->on_expr))
{
// table->maybe_null=table->outer_join=1; // Mark for send fields
+ if (!table->file->records)
+ { // Empty table
+ s->key_dependent=s->dependent=0;
+ s->type=JT_SYSTEM;
+ const_table_map|=table->map;
+ set_position(join,const_count++,s,(KEYUSE*) 0);
+ continue;
+ }
s->key_dependent=s->dependent=
s->on_expr->used_tables() & ~(table->map);
s->dependent|=stat_vector[i-1]->dependent | table_vector[i-1]->map;
diff --git a/sql/table.h b/sql/table.h
index 7fe3e5de601..198e0d6e801 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -91,6 +91,7 @@ struct st_table {
my_bool crypted;
my_bool db_low_byte_first; /* Portable row format */
my_bool locked_by_flush;
+ my_bool locked_by_name;
Field *next_number_field, /* Set if next_number is activated */
*found_next_number_field, /* Set on open */
*rowid_field;
diff --git a/tests/drop_test.pl b/tests/drop_test.pl
new file mode 100755
index 00000000000..9dcadf45c2e
--- /dev/null
+++ b/tests/drop_test.pl
@@ -0,0 +1,220 @@
+#!/usr/bin/perl -w
+#
+# This is a test with uses processes to insert, select and drop tables.
+#
+
+$opt_loop_count=100000; # Change this to make test harder/easier
+
+##################### Standard benchmark inits ##############################
+
+use DBI;
+use Getopt::Long;
+use Benchmark;
+
+package main;
+
+$opt_skip_create=$opt_skip_in=$opt_verbose=$opt_fast_insert=
+ $opt_lock_tables=$opt_debug=$opt_skip_delete=$opt_fast=$opt_force=0;
+$opt_host=""; $opt_db="test";
+
+GetOptions("host=s","db=s","loop-count=i","skip-create","skip-in","skip-delete",
+"verbose","fast-insert","lock-tables","debug","fast","force") || die "Aborted";
+$opt_verbose=$opt_debug=$opt_lock_tables=$opt_fast_insert=$opt_fast=$opt_skip_in=$opt_force=undef; # Ignore warnings from these
+
+print "Testing 5 multiple connections to a server with 1 insert, 2 drop/rename\n";
+print "1 select and 1 flush thread\n";
+
+$firsttable = "bench_f1";
+
+####
+#### Start timeing and start test
+####
+
+$start_time=new Benchmark;
+if (!$opt_skip_create)
+{
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+ $dbh->do("drop table if exists $firsttable, ${firsttable}_1, ${firsttable}_2");
+
+ print "Creating table $firsttable in database $opt_db\n";
+ $dbh->do("create table $firsttable (id int(6) not null, info varchar(32), marker char(1), primary key(id))") || die $DBI::errstr;
+ $dbh->disconnect; $dbh=0; # Close handler
+}
+$|= 1; # Autoflush
+
+####
+#### Start the tests
+####
+
+test_insert() if (($pid=fork()) == 0); $work{$pid}="insert";
+test_drop(1) if (($pid=fork()) == 0); $work{$pid}="drop 1";
+test_drop(2) if (($pid=fork()) == 0); $work{$pid}="drop 2";
+test_select() if (($pid=fork()) == 0); $work{$pid}="select";
+test_flush() if (($pid=fork()) == 0); $work{$pid}="flush";
+
+$errors=0;
+while (($pid=wait()) != -1)
+{
+ $ret=$?/256;
+ print "thread '" . $work{$pid} . "' finished with exit code $ret\n";
+ $errors++ if ($ret != 0);
+}
+
+if (!$opt_skip_delete && !$errors)
+{
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+ $dbh->do("drop table $firsttable");
+ $dbh->disconnect; $dbh=0; # Close handler
+}
+print ($errors ? "Test failed\n" :"Test ok\n");
+
+$end_time=new Benchmark;
+print "Total time: " .
+ timestr(timediff($end_time, $start_time),"noc") . "\n";
+
+exit(0);
+
+#
+# Insert records in the table
+#
+
+sub test_insert
+{
+ my ($dbh,$i);
+
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+ for ($i=0 ; $i < $opt_loop_count; $i++)
+ {
+ if (!$dbh->do("insert into $firsttable values ($i,'This is entry $i','')"))
+ {
+ print "Warning; Got error on insert: " . $dbh->errstr . "\n" if (! ($dbh->errstr =~ /doesn't exist/));
+ }
+ }
+ $dbh->disconnect; $dbh=0;
+ print "Test_insert: Inserted $i rows\n";
+ exit(0);
+}
+
+
+sub test_drop
+{
+ my ($id) = @_;
+ my ($dbh,$i,$sth,$error_counter,$sleep_time);
+
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+ $error_counter=0;
+ $sleep_time=2;
+ for ($i=0 ; $i < $opt_loop_count ; $i++)
+ {
+ sleep($sleep_time);
+ # Check if insert thread is ready
+ $sth=$dbh->prepare("select count(*) from $firsttable") || die "Got error on select from $firsttable: $dbh->errstr\n";
+ if (!$sth->execute || !(@row = $sth->fetchrow_array()) ||
+ !$row[0])
+ {
+ $sth->finish;
+ $sleep_time=1;
+ last if ($error_counter++ == 5);
+ next;
+ }
+ $sleep_time=2;
+ $sth->finish;
+
+ # Change to use a new table
+ $dbh->do("create table ${firsttable}_$id (id int(6) not null, info varchar(32), marker char(1), primary key(id))") || die $DBI::errstr;
+ $dbh->do("drop table if exists $firsttable") || die "Got error on drop table: $dbh->errstr\n";
+ if (!$dbh->do("alter table ${firsttable}_$id rename to $firsttable"))
+ {
+ print "Warning; Got error from alter table: " . $dbh->errstr . "\n" if (! ($dbh->errstr =~ /already exist/));
+ $dbh->do("drop table if exists ${firsttable}_$id") || die "Got error on drop table: $dbh->errstr\n";
+ }
+ }
+ $dbh->do("drop table if exists $firsttable,${firsttable}_$id") || die "Got error on drop table: $dbh->errstr\n";
+ $dbh->disconnect; $dbh=0;
+ print "Test_drop: Did a drop $i times\n";
+ exit(0);
+}
+
+
+#
+# select records
+#
+
+sub test_select
+{
+ my ($dbh,$i,$sth,@row,$error_counter,$sleep_time);
+
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+
+ $error_counter=0;
+ $sleep_time=3;
+ for ($i=0 ; $i < $opt_loop_count ; $i++)
+ {
+ sleep($sleep_time);
+ $sth=$dbh->prepare("select sum(t.id) from $firsttable as t,$firsttable as t2") || die "Got error on select: $dbh->errstr;\n";
+ if ($sth->execute)
+ {
+ @row = $sth->fetchrow_array();
+ $sth->finish;
+ $sleep_time=3;
+ }
+ else
+ {
+ print "Warning; Got error from select: " . $dbh->errstr . "\n" if (! ($dbh->errstr =~ /doesn't exist/));
+ $sth->finish;
+ last if ($error_counter++ == 5);
+ $sleep_time=1;
+ }
+ }
+ $dbh->disconnect; $dbh=0;
+ print "Test_select: ok\n";
+ exit(0);
+}
+
+#
+# flush records
+#
+
+sub test_flush
+{
+ my ($dbh,$i,$sth,@row,$error_counter,$sleep_time);
+
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+
+ $error_counter=0;
+ $sleep_time=5;
+ for ($i=0 ; $i < $opt_loop_count ; $i++)
+ {
+ sleep($sleep_time);
+ $sth=$dbh->prepare("select count(*) from $firsttable") || die "Got error on prepar: $dbh->errstr;\n";
+ if ($sth->execute)
+ {
+ @row = $sth->fetchrow_array();
+ $sth->finish;
+ $sleep_time=5;
+ $dbh->do("flush tables $firsttable") || die "Got error on flush table: " . $dbh->errstr . "\n";
+ }
+ else
+ {
+ print "Warning; Got error from select: " . $dbh->errstr . "\n" if (! ($dbh->errstr =~ /doesn't exist/));
+ $sth->finish;
+ last if ($error_counter++ == 5);
+ $sleep_time=1;
+ }
+ }
+ $dbh->disconnect; $dbh=0;
+ print "Test_select: ok\n";
+ exit(0);
+}
diff --git a/tests/fork_test.pl b/tests/fork_test.pl
index cd166b84555..26c614a364a 100755
--- a/tests/fork_test.pl
+++ b/tests/fork_test.pl
@@ -67,7 +67,7 @@ $errors=0;
while (($pid=wait()) != -1)
{
$ret=$?/256;
- print "thread '" . $work{$pid} . "' finnished with exit code $ret\n";
+ print "thread '" . $work{$pid} . "' finished with exit code $ret\n";
$errors++ if ($ret != 0);
}
diff --git a/tests/rename_test.pl b/tests/rename_test.pl
new file mode 100755
index 00000000000..bdfb14be927
--- /dev/null
+++ b/tests/rename_test.pl
@@ -0,0 +1,204 @@
+#!/usr/bin/perl -w
+#
+# This is a test with uses processes to insert, select and drop tables.
+#
+
+$opt_loop_count=100000; # Change this to make test harder/easier
+
+##################### Standard benchmark inits ##############################
+
+use DBI;
+use Getopt::Long;
+use Benchmark;
+
+package main;
+
+$opt_skip_create=$opt_skip_delete=$opt_skip_flush=0;
+$opt_host=""; $opt_db="test";
+
+GetOptions("host=s","db=s","loop-count=i","skip-create","skip-delete",
+"skip-flush") || die "Aborted";
+
+print "Testing 5 multiple connections to a server with 1 insert, 1 rename\n";
+print "1 select and 1 flush thread\n";
+
+$firsttable = "bench_f1";
+
+####
+#### Start timing and start test
+####
+
+$start_time=new Benchmark;
+if (!$opt_skip_create)
+{
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+ $dbh->do("drop table if exists $firsttable, ${firsttable}_1, ${firsttable}_2");
+
+ print "Creating table $firsttable in database $opt_db\n";
+ $dbh->do("create table $firsttable (id int(6) not null, info varchar(32), marker char(1), primary key(id))") || die $DBI::errstr;
+ $dbh->disconnect; $dbh=0; # Close handler
+}
+$|= 1; # Autoflush
+
+####
+#### Start the tests
+####
+
+test_insert() if (($pid=fork()) == 0); $work{$pid}="insert";
+test_rename(1) if (($pid=fork()) == 0); $work{$pid}="rename 1";
+test_rename(2) if (($pid=fork()) == 0); $work{$pid}="rename 2";
+test_select() if (($pid=fork()) == 0); $work{$pid}="select";
+if (!$opt_skip_flush)
+{
+ test_flush() if (($pid=fork()) == 0); $work{$pid}="flush";
+}
+$errors=0;
+while (($pid=wait()) != -1)
+{
+ $ret=$?/256;
+ print "thread '" . $work{$pid} . "' finished with exit code $ret\n";
+ $errors++ if ($ret != 0);
+}
+
+if (!$opt_skip_delete && !$errors)
+{
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+ $dbh->do("drop table $firsttable");
+ $dbh->disconnect; $dbh=0; # Close handler
+}
+print ($errors ? "Test failed\n" :"Test ok\n");
+
+$end_time=new Benchmark;
+print "Total time: " .
+ timestr(timediff($end_time, $start_time),"noc") . "\n";
+
+exit(0);
+
+#
+# Insert records in the table. Delete table when test is finnished
+#
+
+sub test_insert
+{
+ my ($dbh,$i,$error);
+
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+ for ($i=0 ; $i < $opt_loop_count; $i++)
+ {
+ if (!$dbh->do("insert into $firsttable values ($i,'This is entry $i','')"))
+ {
+ $error=$dbh->errstr;
+ $dbh->do("drop table ${firsttable}"); # End other threads
+ die "Warning; Got error on insert: " . $error . "\n";
+ }
+ }
+ sleep(1);
+ $dbh->do("drop table ${firsttable}") || die "Got error on drop table: " . $dbh->errstr . "\n";
+ $dbh->disconnect; $dbh=0;
+ print "Test_insert: Inserted $i rows\n";
+ exit(0);
+}
+
+
+sub test_rename
+{
+ my ($id) = @_;
+ my ($dbh,$i,$error_counter,$sleep_time);
+
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+ $error_counter=0;
+ $sleep_time=2;
+ for ($i=0 ; $i < $opt_loop_count ; $i++)
+ {
+ sleep($sleep_time);
+ $dbh->do("create table ${firsttable}_$id (id int(6) not null, info varchar(32), marker char(1), primary key(id))") || die $DBI::errstr;
+ if (!$dbh->do("rename table $firsttable to ${firsttable}_${id}_1, ${firsttable}_$id to ${firsttable}"))
+ {
+ last if ($dbh->errstr =~ /^Can\'t find/);
+ die "Got error on rename: " . $dbh->errstr . "\n";
+ }
+ $dbh->do("drop table ${firsttable}_${id}_1") || die "Got error on drop table: " . $dbh->errstr . "\n";
+ }
+ $dbh->disconnect; $dbh=0;
+ print "Test_drop: Did a drop $i times\n";
+ exit(0);
+}
+
+
+#
+# select records
+#
+
+sub test_select
+{
+ my ($dbh,$i,$sth,@row,$sleep_time);
+
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+
+ $sleep_time=3;
+ for ($i=0 ; $i < $opt_loop_count ; $i++)
+ {
+ sleep($sleep_time);
+ $sth=$dbh->prepare("select sum(t.id) from $firsttable as t,$firsttable as t2") || die "Got error on select: $dbh->errstr;\n";
+ if ($sth->execute)
+ {
+ @row = $sth->fetchrow_array();
+ $sth->finish;
+ }
+ else
+ {
+ $sth->finish;
+ last if (! ($dbh->errstr =~ /doesn\'t exist/));
+ die "Got error on select: " . $dbh->errstr . "\n";
+ }
+ }
+ $dbh->disconnect; $dbh=0;
+ print "Test_select: ok\n";
+ exit(0);
+}
+
+#
+# flush records
+#
+
+sub test_flush
+{
+ my ($dbh,$i,$sth,@row,$error_counter,$sleep_time);
+
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+
+ $error_counter=0;
+ $sleep_time=5;
+ for ($i=0 ; $i < $opt_loop_count ; $i++)
+ {
+ sleep($sleep_time);
+ $sth=$dbh->prepare("select count(*) from $firsttable") || die "Got error on prepar: $dbh->errstr;\n";
+ if ($sth->execute)
+ {
+ @row = $sth->fetchrow_array();
+ $sth->finish;
+ $sleep_time=5;
+ $dbh->do("flush tables $firsttable") || die "Got error on flush table: " . $dbh->errstr . "\n";
+ }
+ else
+ {
+ last if (! ($dbh->errstr =~ /doesn\'t exist/));
+ die "Got error on flush: " . $dbh->errstr . "\n";
+ }
+ }
+ $dbh->disconnect; $dbh=0;
+ print "Test_select: ok\n";
+ exit(0);
+}