Merge kpettersson@bk-internal:/home/bk/mysql-5.0-maint

into  naruto.:C:/cpp/mysql-5.0-maint
This commit is contained in:
unknown 2007-03-09 07:51:40 +01:00
commit cf78a908c8
491 changed files with 12048 additions and 9726 deletions

View File

@ -696,6 +696,7 @@ mysql-test/*.ds?
mysql-test/*.vcproj
mysql-test/gmon.out
mysql-test/install_test_db
mysql-test/lib/init_db.sql
mysql-test/mtr
mysql-test/mysql-test-run
mysql-test/mysql-test-run-shell
@ -1098,6 +1099,7 @@ scripts/mysql_explain_log
scripts/mysql_find_rows
scripts/mysql_fix_extensions
scripts/mysql_fix_privilege_tables
scripts/mysql_fix_privilege_tables.sql
scripts/mysql_install_db
scripts/mysql_secure_installation
scripts/mysql_setpermission

View File

@ -34,6 +34,7 @@ Note: this script is intended for internal use by MySQL developers.
EOF
* )
echo "Unknown option '$1'"
echo "Use -h or --help for usage"
exit 1
break ;;
esac
@ -49,11 +50,14 @@ SSL_LIBRARY=--with-yassl
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
# The following warning flag will give too many warnings:
# -Wshadow -Wunused -Winline (The later isn't usable in C++ as
# -Wunused -Winline (The later isn't usable in C++ as
# __attribute()__ doesn't work with gnu C++)
global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings"
#debug_extra_warnings="-Wuninitialized"
global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable"
#
# For more warnings, uncomment the following line
# global_warnings="$global_warnings -Wshadow"
c_warnings="$global_warnings -Wunused"
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
base_max_configs="--with-innodb --with-ndbcluster --with-archive-storage-engine --with-big-tables --with-blackhole-storage-engine --with-federated-storage-engine --with-csv-storage-engine $SSL_LIBRARY"

View File

@ -14,7 +14,9 @@ export LDFLAGS="-fprofile-arcs -ftest-coverage"
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
# code with profiling information used by gcov.
# the -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM"
extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -DDISABLE_TAO_ASM $debug_cflags $max_cflags -DMYSQL_SERVER_SUFFIX=-gcov"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs --disable-shared $static_link"
extra_configs="$extra_configs $max_configs"

View File

@ -17,7 +17,7 @@ noinst_SCRIPTS = Support/generate-text-files.pl
EXTRA_DIST = $(noinst_SCRIPTS) manual.chm mysql.info INSTALL-BINARY
TXT_FILES= ../INSTALL-SOURCE ../INSTALL-WIN-SOURCE ../EXCEPTIONS-CLIENT \
TXT_FILES= ../INSTALL-SOURCE ../INSTALL-WIN-SOURCE \
INSTALL-BINARY ../support-files/MacOSX/ReadMe.txt
all-local: $(TXT_FILES)
@ -55,9 +55,6 @@ GT = $(srcdir)/Support/generate-text-files.pl
INSTALL-BINARY: $(srcdir)/mysql.info $(GT)
perl -w $(GT) $(srcdir)/mysql.info "installing-binary" "installing-source" > $@
../EXCEPTIONS-CLIENT: $(srcdir)/mysql.info $(GT)
perl -w $(GT) $(srcdir)/mysql.info "mysql-floss-license-exception" "function-index" > $@
../support-files/MacOSX/ReadMe.txt: $(srcdir)/mysql.info $(GT)
perl -w $(GT) $(srcdir)/mysql.info "mac-os-x-installation" "netware-installation" > $@

117
EXCEPTIONS-CLIENT Normal file
View File

@ -0,0 +1,117 @@
MySQL FLOSS License Exception
The MySQL AB Exception for Free/Libre and Open Source
Software-only Applications Using MySQL Client Libraries (the
"FLOSS Exception").
Version 0.5, 30 August 2006
Exception Intent
We want specified Free/Libre and Open Source Software (``FLOSS'')
applications to be able to use specified GPL-licensed MySQL client
libraries (the ``Program'') despite the fact that not all FLOSS
licenses are compatible with version 2 of the GNU General Public
License (the ``GPL'').
Legal Terms and Conditions
As a special exception to the terms and conditions of version 2.0
of the GPL:
1. You are free to distribute a Derivative Work that is formed
entirely from the Program and one or more works (each, a
"FLOSS Work") licensed under one or more of the licenses
listed below in section 1, as long as:
a. You obey the GPL in all respects for the Program and the
Derivative Work, except for identifiable sections of the
Derivative Work which are not derived from the Program,
and which can reasonably be considered independent and
separate works in themselves,
b. all identifiable sections of the Derivative Work which
are not derived from the Program, and which can
reasonably be considered independent and separate works
in themselves,
i. are distributed subject to one of the FLOSS licenses
listed below, and
ii. the object code or executable form of those sections
are accompanied by the complete corresponding
machine-readable source code for those sections on
the same medium and under the same FLOSS license as
the corresponding object code or executable forms of
those sections, and
c. any works which are aggregated with the Program or with a
Derivative Work on a volume of a storage or distribution
medium in accordance with the GPL, can reasonably be
considered independent and separate works in themselves
which are not derivatives of either the Program, a
Derivative Work or a FLOSS Work.
If the above conditions are not met, then the Program may only
be copied, modified, distributed or used under the terms and
conditions of the GPL or another valid licensing option from
MySQL AB.
2. FLOSS License List
License name Version(s)/Copyright Date
Academic Free License 2.0
Apache Software License 1.0/1.1/2.0
Apple Public Source License 2.0
Artistic license From Perl 5.8.0
BSD license "July 22 1999"
Common Public License 1.0
GNU Library or "Lesser" General Public License (LGPL) 2.0/2.1
Jabber Open Source License 1.0
MIT license ---
Mozilla Public License (MPL) 1.0/1.1
Open Software License 2.0
OpenSSL license (with original SSLeay license) "2003" ("1998")
PHP License 3.0
Python license (CNRI Python License) ---
Python Software Foundation License 2.1.1
Sleepycat License "1999"
University of Illinois/NCSA Open Source License ---
W3C License "2001"
X11 License "2001"
Zlib/libpng License ---
Zope Public License 2.0
Due to the many variants of some of the above licenses, we
require that any version follow the 2003 version of the Free
Software Foundation's Free Software Definition
(http://www.gnu.org/philosophy/free-sw.html) or version 1.9 of
the Open Source Definition by the Open Source Initiative
(http://www.opensource.org/docs/definition.php).
3. Definitions
a. Terms used, but not defined, herein shall have the
meaning provided in the GPL.
b. Derivative Work means a derivative work under copyright
law.
4. Applicability: This FLOSS Exception applies to all Programs
that contain a notice placed by MySQL AB saying that the
Program may be distributed under the terms of this FLOSS
Exception. If you create or distribute a work which is a
Derivative Work of both the Program and any other work
licensed under the GPL, then this FLOSS Exception is not
available for that work; thus, you must remove the FLOSS
Exception notice from that work and comply with the GPL in all
respects, including by retaining all GPL notices. You may
choose to redistribute a copy of the Program exclusively under
the terms of the GPL by removing the FLOSS Exception notice
from that copy of the Program, provided that the copy has
never been modified by you or any third party.
Appendix A. Qualified Libraries and Packages
The following is a non-exhaustive list of libraries and packages
which are covered by the FLOSS License Exception. Please note that
this appendix is provided merely as an additional service to
specific FLOSS projects wishing to simplify licensing information
for their users. Compliance with one of the licenses noted under
the "FLOSS license list" section remains a prerequisite.
Package Name Qualifying License and Version
Apache Portable Runtime (APR) Apache Software License 2.0

View File

@ -903,32 +903,26 @@ Global
{62E85884-3ACF-4F4C-873B-60B878147890}.Release.ActiveCfg = Release|Win32
{62E85884-3ACF-4F4C-873B-60B878147890}.Release.Build.0 = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.classic.ActiveCfg = classic|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.classic.Build.0 = classic|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.classic nt.ActiveCfg = classic|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.classic nt.Build.0 = classic|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Debug.ActiveCfg = Debug|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Debug.Build.0 = Debug|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Classic.ActiveCfg = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Classic.Build.0 = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Debug.ActiveCfg = Debug|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Debug.Build.0 = Debug|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Pro.ActiveCfg = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Pro.Build.0 = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_ProGPL.ActiveCfg = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_ProGPL.Build.0 = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Release.ActiveCfg = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Embedded_Release.Build.0 = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Max.ActiveCfg = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Max.Build.0 = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Max nt.ActiveCfg = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Max nt.Build.0 = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.nt.ActiveCfg = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.nt.Build.0 = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro.ActiveCfg = pro|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro.Build.0 = pro|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro gpl.ActiveCfg = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro gpl.Build.0 = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro gpl nt.ActiveCfg = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro gpl nt.Build.0 = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro nt.ActiveCfg = pro|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.pro nt.Build.0 = pro|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Release.ActiveCfg = Release|Win32
{37D9BA79-302E-4582-A545-CB5FF7982EA3}.Release.Build.0 = Release|Win32
{89F24ECE-9953-40EF-BDF4-B41F5631E92B}.classic.ActiveCfg = classic|Win32
{89F24ECE-9953-40EF-BDF4-B41F5631E92B}.classic.Build.0 = classic|Win32
{89F24ECE-9953-40EF-BDF4-B41F5631E92B}.classic nt.ActiveCfg = classic|Win32
@ -1011,32 +1005,26 @@ Global
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Release.ActiveCfg = Release|Win32
{AD95DAD3-6DB9-4F8B-A345-7A39A83AAD3A}.Release.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.classic.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.classic.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.classic nt.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.classic nt.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Debug.ActiveCfg = Debug|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Debug.Build.0 = Debug|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Classic.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Classic.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Debug.ActiveCfg = Debug|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Debug.Build.0 = Debug|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Pro.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Pro.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_ProGPL.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_ProGPL.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Release.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Embedded_Release.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Max.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Max.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Max nt.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Max nt.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.nt.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.nt.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.pro.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.pro.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.pro gpl.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.pro gpl.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.pro gpl nt.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.pro gpl nt.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.pro nt.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.pro nt.Build.0 = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Release.ActiveCfg = Release|Win32
{94B86159-C581-42CD-825D-C69CBC237E5C}.Release.Build.0 = Release|Win32
{3737BFE2-EF25-464F-994D-BD28A9F84528}.classic.ActiveCfg = classic|Win32
{3737BFE2-EF25-464F-994D-BD28A9F84528}.classic.Build.0 = classic|Win32
{3737BFE2-EF25-464F-994D-BD28A9F84528}.classic nt.ActiveCfg = classic|Win32
@ -1303,10 +1291,15 @@ Global
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.classic nt.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Debug.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Embedded_Classic.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Embedded_Classic.Build.0 = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Embedded_Debug.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Embedded_Debug.Build.0 = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Embedded_Pro.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Embedded_Pro.Build.0 = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Embedded_ProGPL.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Embedded_ProGPL.Build.0 = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Embedded_Release.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Embedded_Release.Build.0 = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Max.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.Max nt.ActiveCfg = Release|Win32
{6F01B69C-B1A5-4C45-B3A9-744E1EB0BED5}.nt.ActiveCfg = Release|Win32

View File

@ -95,3 +95,5 @@ TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient dbug yassl taocrypt zlib wsock32)
ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug yassl taocrypt zlib wsock32)
ADD_EXECUTABLE(echo echo.c)

View File

@ -58,7 +58,7 @@ DEFS = -DUNDEF_THREADS_HACK \
-DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
-DDATADIR="\"$(localstatedir)\""
EXTRA_DIST = get_password.c CMakeLists.txt
EXTRA_DIST = get_password.c CMakeLists.txt echo.c
link_sources:
for f in $(sql_src) ; do \

45
client/echo.c Normal file
View File

@ -0,0 +1,45 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
echo is a replacement for the "echo" command builtin to cmd.exe
on Windows, to get a Unix eqvivalent behaviour when running commands
like:
$> echo "hello" | mysql
The windows "echo" would have sent "hello" to mysql while
Unix echo will send hello without the enclosing hyphens
This is a very advanced high tech program so take care when
you change it and remember to valgrind it before production
use.
*/
#include <stdio.h>
int main(int argc, char **argv)
{
int i;
for (i= 1; i < argc; i++)
{
fprintf(stdout, "%s", argv[i]);
if (i < argc - 1)
fprintf(stdout, " ");
}
fprintf(stdout, "\n");
return 0;
}

View File

@ -131,7 +131,7 @@ typedef enum enum_info_type INFO_TYPE;
static MYSQL mysql; /* The connection */
static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
connected=0,opt_raw_data=0,unbuffered=0,output_tables=0,
rehash=1,skip_updates=0,safe_updates=0,one_database=0,
opt_rehash=1,skip_updates=0,safe_updates=0,one_database=0,
opt_compress=0, using_opt_local_infile=0,
vertical=0, line_numbers=1, column_names=1,opt_html=0,
opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
@ -443,10 +443,6 @@ int main(int argc,char *argv[])
signal(SIGINT, mysql_sigint); // Catch SIGINT to clean up
signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up
/*
Run in interactive mode like the ingres/postgres monitor
*/
put_info("Welcome to the MySQL monitor. Commands end with ; or \\g.",
INFO_INFO);
sprintf((char*) glob_buffer.ptr(),
@ -585,7 +581,8 @@ static struct my_option my_long_options[] =
#endif
{"auto-rehash", OPT_AUTO_REHASH,
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
(gptr*) &rehash, (gptr*) &rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
(gptr*) &opt_rehash, (gptr*) &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
0, 0},
{"no-auto-rehash", 'A',
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -888,7 +885,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
}
break;
case 'A':
rehash= 0;
opt_rehash= 0;
break;
case 'N':
column_names= 0;
@ -1768,15 +1765,17 @@ char *rindex(const char *s,int c)
static int reconnect(void)
{
/* purecov: begin tested */
if (opt_reconnect)
{
put_info("No connection. Trying to reconnect...",INFO_INFO);
(void) com_connect((String *) 0, 0);
if (rehash)
if (opt_rehash)
com_rehash(NULL, NULL);
}
if (!connected)
return put_info("Can't connect to the server\n",INFO_ERROR);
/* purecov: end */
return 0;
}
@ -2941,7 +2940,7 @@ static int
com_connect(String *buffer, char *line)
{
char *tmp, buff[256];
bool save_rehash= rehash;
bool save_rehash= opt_rehash;
int error;
bzero(buff, sizeof(buff));
@ -2965,13 +2964,16 @@ com_connect(String *buffer, char *line)
}
}
else
rehash= 0; // Quick re-connect
{
/* Quick re-connect */
opt_rehash= 0; /* purecov: tested */
}
buffer->length(0); // command used
}
else
rehash= 0;
opt_rehash= 0;
error=sql_connect(current_host,current_db,current_user,opt_password,0);
rehash= save_rehash;
opt_rehash= save_rehash;
if (connected)
{
@ -3133,7 +3135,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
current_db=my_strdup(tmp,MYF(MY_WME));
#ifdef HAVE_READLINE
if (select_db > 1)
build_completion_hash(rehash, 1);
build_completion_hash(opt_rehash, 1);
#endif
}
@ -3287,7 +3289,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
mysql.reconnect= 1;
#endif
#ifdef HAVE_READLINE
build_completion_hash(rehash, 1);
build_completion_hash(opt_rehash, 1);
#endif
return 0;
}
@ -3332,8 +3334,8 @@ static int
com_status(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
{
const char *status;
char buff[22];
const char *status_str;
char buff[40];
ulonglong id;
MYSQL_RES *result;
LINT_INIT(result);
@ -3359,9 +3361,9 @@ com_status(String *buffer __attribute__((unused)),
mysql_free_result(result);
}
#ifdef HAVE_OPENSSL
if ((status= mysql_get_ssl_cipher(&mysql)))
if ((status_str= mysql_get_ssl_cipher(&mysql)))
tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
status);
status_str);
else
#endif /* HAVE_OPENSSL */
tee_puts("SSL:\t\t\tNot in use", stdout);
@ -3420,23 +3422,20 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "Protocol:\t\tCompressed\n");
#endif
if ((status=mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
{
ulong sec;
char buff[40];
const char *pos= strchr(status,' ');
const char *pos= strchr(status_str,' ');
/* print label */
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status), status);
if ((status=str2int(pos,10,0,LONG_MAX,(long*) &sec)))
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status_str), status_str);
if ((status_str= str2int(pos,10,0,LONG_MAX,(long*) &sec)))
{
nice_time((double) sec,buff,0);
tee_puts(buff, stdout); /* print nice time */
while (*status == ' ') status++; /* to next info */
}
if (status)
{
while (*status_str == ' ')
status_str++; /* to next info */
tee_putc('\n', stdout);
tee_puts(status, stdout);
tee_puts(status_str, stdout);
}
}
if (safe_updates)
@ -3456,7 +3455,7 @@ select_limit, max_join_size);
}
static const char *
server_version_string(MYSQL *mysql)
server_version_string(MYSQL *con)
{
static char buf[MAX_SERVER_VERSION_LENGTH] = "";
@ -3466,11 +3465,11 @@ server_version_string(MYSQL *mysql)
char *bufp = buf;
MYSQL_RES *result;
bufp = strnmov(buf, mysql_get_server_info(mysql), sizeof buf);
bufp= strnmov(buf, mysql_get_server_info(con), sizeof buf);
/* "limit 1" is protection against SQL_SELECT_LIMIT=0 */
if (!mysql_query(mysql, "select @@version_comment limit 1") &&
(result = mysql_use_result(mysql)))
if (!mysql_query(con, "select @@version_comment limit 1") &&
(result = mysql_use_result(con)))
{
MYSQL_ROW cur = mysql_fetch_row(result);
if (cur && cur[0])
@ -3560,10 +3559,10 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
static int
put_error(MYSQL *mysql)
put_error(MYSQL *con)
{
return put_info(mysql_error(mysql), INFO_ERROR, mysql_errno(mysql),
mysql_sqlstate(mysql));
return put_info(mysql_error(con), INFO_ERROR, mysql_errno(con),
mysql_sqlstate(con));
}
@ -3822,8 +3821,6 @@ static const char* construct_prompt()
break;
case 'D':
char* dateTime;
time_t lclock;
lclock = time(NULL);
dateTime = ctime(&lclock);
processed_prompt.append(strtok(dateTime,"\n"));
break;

View File

@ -54,6 +54,8 @@ static char *default_dbug_option= (char*) "d:t:O,/tmp/mysql_upgrade.trace";
#endif
static my_bool info_flag= 0, tty_password= 0;
static char **defaults_argv;
static struct my_option my_long_options[]=
{
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
@ -171,7 +173,7 @@ void set_extra_default(int id, const struct my_option *opt)
}
d= (extra_default_t *)my_malloc(sizeof(extra_default_t),
MYF(MY_FAE|MY_ZEROFILL));
MYF(MY_FAE | MY_ZEROFILL));
d->id= id;
d->name= opt->name;
d->n_len= strlen(opt->name);
@ -282,6 +284,10 @@ static int create_defaults_file(const char *path, const char *forced_path)
DYNAMIC_STRING buf;
extra_default_t *d;
DBUG_ENTER("create_defaults_file");
DBUG_PRINT("enter", ("path: %s, forced_path: %s", path, forced_path));
/* Delete any previous defaults file generated by mysql_upgrade */
my_delete(path, MYF(0));
defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY | O_EXCL,
@ -298,6 +304,7 @@ static int create_defaults_file(const char *path, const char *forced_path)
goto error;
}
/* Copy forced_path file into the defaults_file being generated */
if (forced_path)
{
forced_file= my_open(forced_path, O_RDONLY, MYF(MY_FAE | MY_WME));
@ -306,6 +313,7 @@ static int create_defaults_file(const char *path, const char *forced_path)
ret= 1;
goto error;
}
DBUG_PRINT("info", ("Copying from %s to %s", forced_path, path));
do
{
cnt= my_read(forced_file, buf.str, buf.max_length, MYF(MY_WME));
@ -316,10 +324,12 @@ static int create_defaults_file(const char *path, const char *forced_path)
my_close(forced_file, MYF(0));
goto error;
}
DBUG_PRINT("info", ("%s", buf.str));
} while (cnt == buf.max_length);
my_close(forced_file, MYF(0));
}
/* Write all extra_default options into the [client] section */
dynstr_set(&buf, "\n[client]");
if (opt_password)
{
@ -330,6 +340,7 @@ static int create_defaults_file(const char *path, const char *forced_path)
goto error;
}
}
DBUG_PRINT("info", ("Writing extra_defaults to file"));
while (extra_defaults)
{
int len;
@ -338,6 +349,7 @@ static int create_defaults_file(const char *path, const char *forced_path)
len= d->n_len + d->v_len + 1;
if (buf.length + len >= buf.max_length) /* to avoid realloc() */
{
if (my_write(defaults_file, buf.str, buf.length, MYF(MY_FNABP | MY_WME)))
{
ret= 1;
@ -345,15 +357,16 @@ static int create_defaults_file(const char *path, const char *forced_path)
}
dynstr_set(&buf, NULL);
}
if (dynstr_append_mem(&buf, "\n", 1)
|| dynstr_append_mem(&buf, d->name, d->n_len)
|| (d->v_len && (dynstr_append_mem(&buf, "=", 1)
|| dynstr_append_mem(&buf, d->value, d->v_len))))
if (dynstr_append_mem(&buf, "\n", 1) ||
dynstr_append_mem(&buf, d->name, d->n_len) ||
(d->v_len && (dynstr_append_mem(&buf, "=", 1) ||
dynstr_append_mem(&buf, d->value, d->v_len))))
{
ret= 1;
goto error;
}
my_delete((gptr)d, MYF(0));
DBUG_PRINT("info", ("%s", buf.str));
my_free((gptr)d, MYF(0));
list_pop(extra_defaults); /* pop off the head */
}
if (my_write(defaults_file, buf.str, buf.length, MYF(MY_FNABP | MY_WME)))
@ -373,7 +386,7 @@ error:
my_delete(path, MYF(0));
out:
return ret;
DBUG_RETURN(ret);
}
@ -449,13 +462,10 @@ int main(int argc, char **argv)
char *forced_defaults_file;
char *forced_extra_defaults;
char *defaults_group_suffix;
const char *script_line;
char *upgrade_defaults_path;
char *defaults_to_use= NULL;
int upgrade_defaults_created= 0;
char path[FN_REFLEN];
char *local_defaults_group_suffix;
int no_defaults;
char path[FN_REFLEN], upgrade_defaults_path[FN_REFLEN];
DYNAMIC_STRING cmdline;
MY_INIT(argv[0]);
@ -464,11 +474,16 @@ int main(int argc, char **argv)
#endif
/* Check if we are forced to use specific defaults */
no_defaults= 0;
if (argc >= 2 && !strcmp(argv[1],"--no-defaults"))
no_defaults= 1;
get_defaults_options(argc, argv,
&forced_defaults_file, &forced_extra_defaults,
&defaults_group_suffix);
&local_defaults_group_suffix);
load_defaults("my", load_default_groups, &argc, &argv);
defaults_argv= argv;
/*
Must init_dynamic_string before handle_options because string is freed
@ -516,25 +531,19 @@ int main(int argc, char **argv)
goto error;
}
/*
Create the modified defaults file to be used by mysqlcheck
and mysql tools
/*
Create the modified defaults file to be used by mysqlcheck
and mysql command line client
*/
fn_format(path, UPGRADE_DEFAULTS_NAME, datadir, "", MYF(0));
upgrade_defaults_path= my_strdup(path, MYF(0));
if (extra_defaults)
{
ret= create_defaults_file(upgrade_defaults_path, forced_extra_defaults);
if (ret)
goto error;
defaults_to_use= upgrade_defaults_path;
upgrade_defaults_created= 1;
}
else
defaults_to_use= forced_extra_defaults;
fn_format(upgrade_defaults_path, UPGRADE_DEFAULTS_NAME, datadir, "", MYF(0));
create_defaults_file(upgrade_defaults_path, forced_extra_defaults);
/*
Read the mysql_upgrade_info file to check if mysql_upgrade
already has been done
Maybe this could be done a little earlier?
*/
if (!find_file(MYSQL_UPGRADE_INFO_NAME, datadir, MY_SEARCH_SELF,
path, sizeof(path), NULL, NullS)
&& !opt_force)
@ -553,7 +562,9 @@ int main(int argc, char **argv)
goto fix_priv_tables;
}
}
/* Find mysqlcheck */
if (find_file(mysqlcheck_name, basedir, MYF(0), path, sizeof(path),
"bin", EXTRA_CLIENT_PATHS, NullS))
{
@ -575,13 +586,15 @@ int main(int argc, char **argv)
dynstr_append_os_quoted(&cmdline, path, NullS);
}
if (defaults_to_use)
{
dynstr_append(&cmdline, " ");
dynstr_append_os_quoted(&cmdline, "--defaults-extra-file=",
defaults_to_use, NullS);
}
/*
All settings have been written to the "upgrade_defaults_path"
instruct mysqlcheck to only read options from that file
*/
dynstr_append(&cmdline, " ");
dynstr_append_os_quoted(&cmdline,
(no_defaults ? "--defaults-file=" :
"--defaults-extra-file="),
upgrade_defaults_path, NullS);
dynstr_append(&cmdline, " ");
dynstr_append_os_quoted(&cmdline, "--check-upgrade", NullS);
dynstr_append(&cmdline, " ");
@ -594,9 +607,10 @@ int main(int argc, char **argv)
dynstr_append(&cmdline, "\"");
#endif /* __WIN__ */
/* Execute mysqlcheck */
if (opt_verbose)
printf("Running %s\n", cmdline.str);
DBUG_PRINT("info", ("Running: %s", cmdline.str));
ret= system(cmdline.str);
if (ret)
{
@ -610,6 +624,7 @@ int main(int argc, char **argv)
goto error;
fix_priv_tables:
/* Find mysql */
if (find_file(mysql_name, basedir, MYF(0), path, sizeof(path),
"bin", EXTRA_CLIENT_PATHS, NullS))
{
@ -631,6 +646,7 @@ fix_priv_tables:
dynstr_append_os_quoted(&cmdline, path, NullS);
}
/* Find mysql_fix_privililege_tables.sql */
if (find_file(MYSQL_FIX_PRIV_TABLES_NAME, basedir, MYF(0),
path, sizeof(path),
"support_files", "share", "share/mysql", "scripts",
@ -646,15 +662,16 @@ fix_priv_tables:
" where MySQL is installed");
goto error;
}
else
script_line= my_strdup(path, MYF(0));
if (defaults_to_use)
{
dynstr_append(&cmdline, " ");
dynstr_append_os_quoted(&cmdline, "--defaults-extra-file=",
defaults_to_use, NullS);
}
/*
All settings have been written to the "upgrade_defaults_path",
instruct mysql to only read options from that file
*/
dynstr_append(&cmdline, " ");
dynstr_append_os_quoted(&cmdline,
(no_defaults ? "--defaults-file=" :
"--defaults-extra-file="),
upgrade_defaults_path, NullS);
dynstr_append(&cmdline, " ");
dynstr_append_os_quoted(&cmdline, "--force", NullS);
dynstr_append(&cmdline, " ");
@ -666,14 +683,15 @@ fix_priv_tables:
dynstr_append(&cmdline, " ");
dynstr_append_os_quoted(&cmdline, "--database=mysql", NullS);
dynstr_append(&cmdline, " < ");
dynstr_append_os_quoted(&cmdline, script_line, NullS);
dynstr_append_os_quoted(&cmdline, path, NullS);
#ifdef __WIN__
dynstr_append(&cmdline, "\"");
#endif /* __WIN__ */
/* Execute "mysql --force < mysql_fix_privilege_tables.sql" */
if (opt_verbose)
printf("Running %s\n", cmdline.str);
DBUG_PRINT("info", ("Running: %s", cmdline.str));
ret= system(cmdline.str);
if (ret)
fprintf(stderr, "Error executing '%s'\n", cmdline.str);
@ -681,10 +699,11 @@ fix_priv_tables:
error:
dynstr_free(&cmdline);
if (upgrade_defaults_created)
my_delete(upgrade_defaults_path, MYF(0));
my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
/* Delete the generated defaults file */
my_delete(upgrade_defaults_path, MYF(0));
free_defaults(defaults_argv);
my_end(info_flag ? MY_CHECK_ERROR : 0);
return ret;
}

View File

@ -91,15 +91,14 @@ static bool stop_passed= 0;
This is because the event will be created (alloced) in read_log_event()
(which returns a pointer) in check_header().
*/
Format_description_log_event* description_event;
Format_description_log_event* glob_description_event;
static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
const char* logname);
static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
const char* logname);
static int dump_log_entries(const char* logname);
static int dump_remote_file(NET* net, const char* fname);
static void die(const char* fmt, ...);
static void die(const char* fmt, ...) __attribute__ ((__noreturn__));
static MYSQL* safe_connect();
@ -560,7 +559,7 @@ int process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
ce->print(result_file, print_event_info, TRUE);
// If this binlog is not 3.23 ; why this test??
if (description_event->binlog_version >= 3)
if (glob_description_event->binlog_version >= 3)
{
if (load_processor.process(ce))
break; // Error
@ -595,9 +594,9 @@ Create_file event for file_id: %u\n",exv->file_id);
break;
}
case FORMAT_DESCRIPTION_EVENT:
delete description_event;
description_event= (Format_description_log_event*) ev;
print_event_info->common_header_len= description_event->common_header_len;
delete glob_description_event;
glob_description_event= (Format_description_log_event*) ev;
print_event_info->common_header_len= glob_description_event->common_header_len;
ev->print(result_file, print_event_info);
/*
We don't want this event to be deleted now, so let's hide it (I
@ -803,7 +802,7 @@ static void die(const char* fmt, ...)
static void print_version()
{
printf("%s Ver 3.1 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
printf("%s Ver 3.2 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
NETWARE_SET_SCREEN_MODE(1);
}
@ -974,7 +973,7 @@ static int dump_log_entries(const char* logname)
This is not as smart as check_header() (used for local log); it will not work
for a binlog which mixes format. TODO: fix this.
*/
static int check_master_version(MYSQL* mysql,
static int check_master_version(MYSQL *mysql_arg,
Format_description_log_event
**description_event)
{
@ -982,26 +981,31 @@ static int check_master_version(MYSQL* mysql,
MYSQL_ROW row;
const char* version;
if (mysql_query(mysql, "SELECT VERSION()") ||
!(res = mysql_store_result(mysql)))
if (mysql_query(mysql_arg, "SELECT VERSION()") ||
!(res = mysql_store_result(mysql_arg)))
{
/* purecov: begin inspected */
char errmsg[256];
strmake(errmsg, mysql_error(mysql), sizeof(errmsg)-1);
mysql_close(mysql);
strmake(errmsg, mysql_error(mysql_arg), sizeof(errmsg)-1);
mysql_close(mysql_arg);
die("Error checking master version: %s", errmsg);
/* purecov: end */
}
if (!(row = mysql_fetch_row(res)))
{
/* purecov: begin inspected */
mysql_free_result(res);
mysql_close(mysql);
die("Master returned no rows for SELECT VERSION()");
return 1;
/* purecov: end */
}
if (!(version = row[0]))
{
/* purecov: begin inspected */
mysql_free_result(res);
mysql_close(mysql);
mysql_close(mysql_arg);
die("Master reported NULL for the version");
/* purecov: end */
}
switch (*version) {
@ -1020,11 +1024,11 @@ static int check_master_version(MYSQL* mysql,
*description_event= new Format_description_log_event(3);
break;
default:
sql_print_error("Master reported unrecognized MySQL version '%s'",
version);
/* purecov: begin inspected */
mysql_free_result(res);
mysql_close(mysql);
return 1;
mysql_close(mysql_arg);
die("Master reported unrecognized MySQL version '%s'", version);
/* purecov: end */
}
mysql_free_result(res);
return 0;
@ -1052,12 +1056,12 @@ static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
mysql= safe_connect();
net= &mysql->net;
if (check_master_version(mysql, &description_event))
if (check_master_version(mysql, &glob_description_event))
{
fprintf(stderr, "Could not find server version");
DBUG_RETURN(1);
}
if (!description_event || !description_event->is_valid())
if (!glob_description_event || !glob_description_event->is_valid())
{
fprintf(stderr, "Invalid Format_description log event; \
could be out of memory");
@ -1107,7 +1111,7 @@ could be out of memory");
len, net->read_pos[5]));
if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 ,
len - 1, &error_msg,
description_event)))
glob_description_event)))
{
fprintf(stderr, "Could not construct log event object\n");
error= 1;
@ -1115,7 +1119,7 @@ could be out of memory");
}
Log_event_type type= ev->get_type_code();
if (description_event->binlog_version >= 3 ||
if (glob_description_event->binlog_version >= 3 ||
(type != LOAD_EVENT && type != CREATE_FILE_EVENT))
{
/*
@ -1321,7 +1325,7 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
my_close(fd, MYF(MY_WME));
return 1;
}
check_header(file, &description_event);
check_header(file, &glob_description_event);
}
else // reading from stdin;
{
@ -1347,7 +1351,7 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
if (init_io_cache(file, fileno(stdin), 0, READ_CACHE, (my_off_t) 0,
0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE)))
return 1;
check_header(file, &description_event);
check_header(file, &glob_description_event);
if (start_position)
{
/* skip 'start_position' characters from stdin */
@ -1365,7 +1369,7 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
}
}
if (!description_event || !description_event->is_valid())
if (!glob_description_event || !glob_description_event->is_valid())
die("Invalid Format_description log event; could be out of memory");
if (!start_position && my_b_read(file, tmp_buff, BIN_LOG_HEADER_SIZE))
@ -1378,14 +1382,14 @@ static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
char llbuff[21];
my_off_t old_off = my_b_tell(file);
Log_event* ev = Log_event::read_log_event(file, description_event);
Log_event* ev = Log_event::read_log_event(file, glob_description_event);
if (!ev)
{
/*
if binlog wasn't closed properly ("in use" flag is set) don't complain
about a corruption, but treat it as EOF and move to the next binlog.
*/
if (description_event->flags & LOG_EVENT_BINLOG_IN_USE_F)
if (glob_description_event->flags & LOG_EVENT_BINLOG_IN_USE_F)
file->error= 0;
else if (file->error)
{
@ -1410,7 +1414,7 @@ end:
if (fd >= 0)
my_close(fd, MYF(MY_WME));
end_io_cache(file);
delete description_event;
delete glob_description_event;
return error;
}

View File

@ -111,7 +111,7 @@ static char compatible_mode_normal_str[255];
static ulong opt_compatible_mode= 0;
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
static uint opt_mysql_port= 0, err_len= 0, opt_master_data;
static uint opt_mysql_port= 0, opt_master_data;
static my_string opt_mysql_unix_port=0;
static int first_error=0;
static DYNAMIC_STRING extended_row;
@ -723,6 +723,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *end= compatible_mode_normal_str;
int i;
ulong mode;
uint err_len;
opt_quoted= 1;
opt_set_charset= 0;
@ -860,11 +861,11 @@ static int get_options(int *argc, char ***argv)
/*
** DB_error -- prints mysql error message and exits the program.
*/
static void DB_error(MYSQL *mysql, const char *when)
static void DB_error(MYSQL *mysql_arg, const char *when)
{
DBUG_ENTER("DB_error");
fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname,
mysql_errno(mysql), mysql_error(mysql), when);
mysql_errno(mysql_arg), mysql_error(mysql_arg), when);
fflush(stderr);
safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN;
@ -1192,7 +1193,7 @@ static void print_quoted_xml(FILE *xml_file, const char *str, ulong len)
..., attribute_name_n, attribute_value_n, NullS)
xml_file - output file
sbeg - line beginning
send - line ending
line_end - line ending
tag_name - XML tag name.
first_attribute_name - tag and first attribute
first_attribute_value - (Implied) value of first attribute
@ -1212,7 +1213,8 @@ static void print_quoted_xml(FILE *xml_file, const char *str, ulong len)
All attribute_value arguments will be quoted before output.
*/
static void print_xml_tag(FILE * xml_file, const char* sbeg, const char* send,
static void print_xml_tag(FILE * xml_file, const char* sbeg,
const char* line_end,
const char* tag_name,
const char* first_attribute_name, ...)
{
@ -1242,7 +1244,7 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg, const char* send,
va_end(arg_list);
fputc('>', xml_file);
fputs(send, xml_file);
fputs(line_end, xml_file);
check_io(xml_file);
}
@ -1256,7 +1258,7 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg, const char* send,
sbeg - line beginning
stag_atr - tag and attribute
sval - value of attribute
send - line ending
line_end - line ending
DESCRIPTION
Print tag with one attribute to the xml_file. Format is:
@ -1268,7 +1270,7 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg, const char* send,
static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
const char* stag_atr, const char* sval,
const char* send)
const char* line_end)
{
fputs(sbeg, xml_file);
fputs("<", xml_file);
@ -1276,7 +1278,7 @@ static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
fputs("\"", xml_file);
print_quoted_xml(xml_file, sval, strlen(sval));
fputs("\" xsi:nil=\"true\" />", xml_file);
fputs(send, xml_file);
fputs(line_end, xml_file);
check_io(xml_file);
}
@ -2014,7 +2016,8 @@ continue_xml:
*/
static void dump_triggers_for_table(char *table, char *db)
static void dump_triggers_for_table(char *table,
char *db __attribute__((unused)))
{
char *result_table;
char name_buff[NAME_LEN*4+3], table_buff[NAME_LEN*2+3];
@ -2023,7 +2026,6 @@ static void dump_triggers_for_table(char *table, char *db)
FILE *sql_file= md_result_file;
MYSQL_RES *result;
MYSQL_ROW row;
DBUG_ENTER("dump_triggers_for_table");
DBUG_PRINT("enter", ("db: %s, table: %s", db, table));

View File

@ -31,7 +31,7 @@
Holyfoot
*/
#define MTEST_VERSION "3.1"
#define MTEST_VERSION "3.2"
#include <my_global.h>
#include <mysql_embed.h>
@ -60,6 +60,11 @@
# endif
#endif
/* Use cygwin for --exec and --system before 5.0 */
#if MYSQL_VERSION_ID < 50000
#define USE_CYGWIN
#endif
#define MAX_VAR_NAME_LENGTH 256
#define MAX_COLUMNS 256
#define MAX_EMBEDDED_SERVER_ARGS 64
@ -84,10 +89,10 @@ enum {
};
static int record= 0, opt_sleep= -1;
static char *db= 0, *pass= 0;
const char *user= 0, *host= 0, *unix_sock= 0, *opt_basedir= "./";
static char *opt_db= 0, *opt_pass= 0;
const char *opt_user= 0, *opt_host= 0, *unix_sock= 0, *opt_basedir= "./";
const char *opt_include= 0, *opt_charsets_dir;
static int port= 0;
static int opt_port= 0;
static int opt_max_connect_retries;
static my_bool opt_compress= 0, silent= 0, verbose= 0;
static my_bool tty_password= 0;
@ -103,7 +108,7 @@ static my_bool disable_warnings= 0, disable_ps_warnings= 0;
static my_bool disable_info= 1;
static my_bool abort_on_error= 1;
static my_bool server_initialized= 0;
static my_bool is_windows= 0;
static char **default_argv;
static const char *load_default_groups[]= { "mysqltest", "client", 0 };
static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer;
@ -273,7 +278,7 @@ enum enum_commands {
Q_DISABLE_PARSING, Q_ENABLE_PARSING,
Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST,
Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT,
Q_CHMOD_FILE,
Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
@ -358,6 +363,9 @@ const char *command_names[]=
/* Don't execute any more commands, compare result */
"exit",
"chmod",
"append_file",
"cat_file",
"diff_files",
0
};
@ -408,6 +416,8 @@ TYPELIB command_typelib= {array_elements(command_names),"",
DYNAMIC_STRING ds_res, ds_progress, ds_warning_messages;
char builtin_echo[FN_REFLEN];
void die(const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
void abort_not_supported_test(const char *fmt, ...)
@ -435,6 +445,7 @@ void dump_progress();
void do_eval(DYNAMIC_STRING *query_eval, const char *query,
const char *query_end, my_bool pass_through_escape_chars);
void str_to_file(const char *fname, char *str, int size);
void str_to_file2(const char *fname, char *str, int size, my_bool append);
#ifdef __WIN__
void free_tmp_sh_file();
@ -612,15 +623,14 @@ void check_command_args(struct st_command *command,
int i;
const char *ptr= arguments;
const char *start;
DBUG_ENTER("check_command_args");
DBUG_PRINT("enter", ("num_args: %d", num_args));
for (i= 0; i < num_args; i++)
{
const struct command_arg *arg= &args[i];
switch (arg->type)
{
switch (arg->type) {
/* A string */
case ARG_STRING:
/* Skip leading spaces */
@ -785,7 +795,7 @@ void free_used_memory()
dynstr_free(&ds_progress);
dynstr_free(&ds_warning_messages);
free_all_replace();
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(default_argv);
free_re();
#ifdef __WIN__
@ -935,10 +945,10 @@ void warning_msg(const char *fmt, ...)
dynstr_append_mem(&ds_warning_messages,
buff, len);
}
#ifndef __WIN__
len= vsnprintf(buff, sizeof(buff), fmt, args);
len= my_vsnprintf(buff, sizeof(buff), fmt, args);
dynstr_append_mem(&ds_warning_messages, buff, len);
#endif
dynstr_append(&ds_warning_messages, "\n");
va_end(args);
@ -1334,7 +1344,7 @@ void var_set_errno(int sql_errno)
void var_query_set(VAR *var, const char *query, const char** query_end)
{
char* end = (char*)((query_end && *query_end) ?
char *end = (char*)((query_end && *query_end) ?
*query_end : query + strlen(query));
MYSQL_RES *res;
MYSQL_ROW row;
@ -1365,7 +1375,6 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
DYNAMIC_STRING result;
uint i;
ulong *lengths;
char *end;
#ifdef NOT_YET
MYSQL_FIELD *fields= mysql_fetch_fields(res);
#endif
@ -1538,29 +1547,36 @@ void do_source(struct st_command *command)
}
#ifdef __WIN__
#if defined __WIN__
#ifdef USE_CYGWIN
/* Variables used for temporary sh files used for emulating Unix on Windows */
char tmp_sh_name[64], tmp_sh_cmd[70];
#endif
void init_tmp_sh_file()
{
#ifdef USE_CYGWIN
/* Format a name for the tmp sh file that is unique for this process */
my_snprintf(tmp_sh_name, sizeof(tmp_sh_name), "tmp_%d.sh", getpid());
/* Format the command to execute in order to run the script */
my_snprintf(tmp_sh_cmd, sizeof(tmp_sh_cmd), "sh %s", tmp_sh_name);
#endif
}
void free_tmp_sh_file()
{
#ifdef USE_CYGWIN
my_delete(tmp_sh_name, MYF(0));
#endif
}
#endif
FILE* my_popen(DYNAMIC_STRING *ds_cmd, const char *mode)
{
#ifdef __WIN__
#if defined __WIN__ && defined USE_CYGWIN
/* Dump the command into a sh script file and execute with popen */
str_to_file(tmp_sh_name, ds_cmd->str, ds_cmd->length);
return popen(tmp_sh_cmd, mode);
@ -1570,6 +1586,64 @@ FILE* my_popen(DYNAMIC_STRING *ds_cmd, const char *mode)
}
static void init_builtin_echo(void)
{
#ifdef __WIN__
/* Look for "echo.exe" in same dir as mysqltest was started from */
dirname_part(builtin_echo, my_progname);
fn_format(builtin_echo, ".\\echo.exe",
builtin_echo, "", MYF(MY_REPLACE_DIR));
/* Make sure echo.exe exists */
if (access(builtin_echo, F_OK) != 0)
builtin_echo[0]= 0;
return;
#else
builtin_echo[0]= 0;
return;
#endif
}
/*
Replace a substring
SYNOPSIS
replace
ds_str The string to search and perform the replace in
search_str The string to search for
search_len Length of the string to search for
replace_str The string to replace with
replace_len Length of the string to replace with
RETURN
0 String replaced
1 Could not find search_str in str
*/
static int replace(DYNAMIC_STRING *ds_str,
const char *search_str, ulong search_len,
const char *replace_str, ulong replace_len)
{
DYNAMIC_STRING ds_tmp;
const char *start= strstr(ds_str->str, search_str);
if (!start)
return 1;
init_dynamic_string(&ds_tmp, "",
ds_str->length + replace_len, 256);
dynstr_append_mem(&ds_tmp, ds_str->str, start - ds_str->str);
dynstr_append_mem(&ds_tmp, replace_str, replace_len);
dynstr_append(&ds_tmp, start + search_len);
dynstr_set(ds_str, ds_tmp.str);
dynstr_free(&ds_tmp);
return 0;
}
/*
Execute given command.
@ -1588,13 +1662,13 @@ FILE* my_popen(DYNAMIC_STRING *ds_cmd, const char *mode)
NOTE
Although mysqltest is executed from cygwin shell, the command will be
executed in "cmd.exe". Thus commands like "rm" etc can NOT be used, use
system for those commands.
mysqltest commmand(s) like "remove_file" for that
*/
void do_exec(struct st_command *command)
{
int error;
char buf[1024];
char buf[512];
FILE *res_file;
char *cmd= command->first_argument;
DYNAMIC_STRING ds_cmd;
@ -1610,7 +1684,25 @@ void do_exec(struct st_command *command)
init_dynamic_string(&ds_cmd, 0, command->query_len+256, 256);
/* Eval the command, thus replacing all environment variables */
do_eval(&ds_cmd, cmd, command->end, TRUE);
do_eval(&ds_cmd, cmd, command->end, !is_windows);
/* Check if echo should be replaced with "builtin" echo */
if (builtin_echo[0] && strncmp(cmd, "echo", 4) == 0)
{
/* Replace echo with our "builtin" echo */
replace(&ds_cmd, "echo", 4, builtin_echo, strlen(builtin_echo));
}
#ifdef __WIN__
#ifndef USE_CYGWIN
/* Replace /dev/null with NUL */
while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0)
;
/* Replace "closed stdout" with non existing output fd */
while(replace(&ds_cmd, ">&-", 3, ">&4", 3) == 0)
;
#endif
#endif
DBUG_PRINT("info", ("Executing '%s' as '%s'",
command->first_argument, ds_cmd.str));
@ -1737,7 +1829,7 @@ int do_modify_var(struct st_command *command,
int my_system(DYNAMIC_STRING* ds_cmd)
{
#ifdef __WIN__
#if defined __WIN__ && defined USE_CYGWIN
/* Dump the command into a sh script file and execute with system */
str_to_file(tmp_sh_name, ds_cmd->str, ds_cmd->length);
return system(tmp_sh_cmd);
@ -1771,7 +1863,16 @@ void do_system(struct st_command *command)
init_dynamic_string(&ds_cmd, 0, command->query_len + 64, 256);
/* Eval the system command, thus replacing all environment variables */
do_eval(&ds_cmd, command->first_argument, command->end, TRUE);
do_eval(&ds_cmd, command->first_argument, command->end, !is_windows);
#ifdef __WIN__
#ifndef USE_CYGWIN
/* Replace /dev/null with NUL */
while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0)
;
#endif
#endif
DBUG_PRINT("info", ("running system command '%s' as '%s'",
command->first_argument, ds_cmd.str));
@ -1874,7 +1975,7 @@ void do_copy_file(struct st_command *command)
void do_chmod_file(struct st_command *command)
{
ulong mode= 0;
long mode= 0;
static DYNAMIC_STRING ds_mode;
static DYNAMIC_STRING ds_file;
const struct command_arg chmod_file_args[] = {
@ -1992,6 +2093,38 @@ void read_until_delimiter(DYNAMIC_STRING *ds,
}
void do_write_file_command(struct st_command *command, my_bool append)
{
static DYNAMIC_STRING ds_content;
static DYNAMIC_STRING ds_filename;
static DYNAMIC_STRING ds_delimiter;
const struct command_arg write_file_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to write to",
"delimiter", ARG_STRING, FALSE, &ds_delimiter, "Delimiter to read until"
};
DBUG_ENTER("do_write_file");
check_command_args(command,
command->first_argument,
write_file_args,
sizeof(write_file_args)/sizeof(struct command_arg),
' ');
/* If no delimiter was provided, use EOF */
if (ds_delimiter.length == 0)
dynstr_set(&ds_delimiter, "EOF");
init_dynamic_string(&ds_content, "", 1024, 1024);
read_until_delimiter(&ds_content, &ds_delimiter);
DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str));
str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append);
dynstr_free(&ds_content);
dynstr_free(&ds_filename);
dynstr_free(&ds_delimiter);
DBUG_VOID_RETURN;
}
/*
SYNOPSIS
do_write_file
@ -2021,36 +2154,174 @@ void read_until_delimiter(DYNAMIC_STRING *ds,
void do_write_file(struct st_command *command)
{
static DYNAMIC_STRING ds_content;
do_write_file_command(command, FALSE);
}
/*
SYNOPSIS
do_append_file
command called command
DESCRIPTION
append_file <file_name> [<delimiter>];
<what to write line 1>
<...>
< what to write line n>
EOF
--append_file <file_name>;
<what to write line 1>
<...>
< what to write line n>
EOF
Append everything between the "append_file" command
and 'delimiter' to "file_name"
Default <delimiter> is EOF
*/
void do_append_file(struct st_command *command)
{
do_write_file_command(command, TRUE);
}
/*
SYNOPSIS
do_cat_file
command called command
DESCRIPTION
cat_file <file_name>;
Print the given file to result log
*/
void do_cat_file(struct st_command *command)
{
int fd;
uint len;
char buff[512];
static DYNAMIC_STRING ds_filename;
static DYNAMIC_STRING ds_delimiter;
const struct command_arg write_file_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to write to",
"delimiter", ARG_STRING, FALSE, &ds_delimiter, "Delimiter to read until"
const struct command_arg cat_file_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to read from"
};
DBUG_ENTER("do_write_file");
DBUG_ENTER("do_cat_file");
check_command_args(command,
command->first_argument,
write_file_args,
sizeof(write_file_args)/sizeof(struct command_arg),
cat_file_args,
sizeof(cat_file_args)/sizeof(struct command_arg),
' ');
/* If no delimiter was provided, use EOF */
if (ds_delimiter.length == 0)
dynstr_set(&ds_delimiter, "EOF");
DBUG_PRINT("info", ("Reading from, file: %s", ds_filename.str));
init_dynamic_string(&ds_content, "", 1024, 1024);
read_until_delimiter(&ds_content, &ds_delimiter);
DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str));
str_to_file(ds_filename.str, ds_content.str, ds_content.length);
dynstr_free(&ds_content);
if ((fd= my_open(ds_filename.str, O_RDONLY, MYF(0))) < 0)
die("Failed to open file %s", ds_filename.str);
while((len= my_read(fd, (byte*)&buff,
sizeof(buff), MYF(0))) > 0)
{
char *p= buff, *start= buff;
while (p < buff+len)
{
/* Convert cr/lf to lf */
if (*p == '\r' && *(p+1) && *(p+1)== '\n')
{
/* Add fake newline instead of cr and output the line */
*p= '\n';
p++; /* Step past the "fake" newline */
dynstr_append_mem(&ds_res, start, p-start);
p++; /* Step past the "fake" newline */
start= p;
}
else
p++;
}
/* Output any chars that migh be left */
dynstr_append_mem(&ds_res, start, p-start);
}
my_close(fd, MYF(0));
dynstr_free(&ds_filename);
dynstr_free(&ds_delimiter);
DBUG_VOID_RETURN;
}
/*
SYNOPSIS
do_diff_files
command called command
DESCRIPTION
diff_files <file1> <file2>;
Fails if the two files differ.
*/
void do_diff_files(struct st_command *command)
{
int error= 0;
int fd, fd2;
uint len, len2;
char buff[512], buff2[512];
static DYNAMIC_STRING ds_filename;
static DYNAMIC_STRING ds_filename2;
const struct command_arg diff_file_args[] = {
"file1", ARG_STRING, TRUE, &ds_filename, "First file to diff",
"file2", ARG_STRING, TRUE, &ds_filename2, "Second file to diff"
};
DBUG_ENTER("do_diff_files");
check_command_args(command,
command->first_argument,
diff_file_args,
sizeof(diff_file_args)/sizeof(struct command_arg),
' ');
if ((fd= my_open(ds_filename.str, O_RDONLY, MYF(0))) < 0)
die("Failed to open first file %s", ds_filename.str);
if ((fd2= my_open(ds_filename2.str, O_RDONLY, MYF(0))) < 0)
{
my_close(fd, MYF(0));
die("Failed to open second file %s", ds_filename2.str);
}
while((len= my_read(fd, (byte*)&buff,
sizeof(buff), MYF(0))) > 0)
{
if ((len2= my_read(fd2, (byte*)&buff2,
sizeof(buff2), MYF(0))) != len)
{
/* File 2 was smaller */
error= 1;
break;
}
if ((memcmp(buff, buff2, len)))
{
/* Content of this part differed */
error= 1;
break;
}
}
if (my_read(fd2, (byte*)&buff2,
sizeof(buff2), MYF(0)) > 0)
{
/* File 1 was smaller */
error= 1;
}
my_close(fd, MYF(0));
my_close(fd2, MYF(0));
dynstr_free(&ds_filename);
dynstr_free(&ds_filename2);
handle_command_error(command, error);
DBUG_VOID_RETURN;
}
/*
SYNOPSIS
do_perl
@ -2156,6 +2427,7 @@ void do_perl(struct st_command *command)
int do_echo(struct st_command *command)
{
DYNAMIC_STRING ds_echo;
DBUG_ENTER("do_echo");
init_dynamic_string(&ds_echo, "", command->query_len, 256);
do_eval(&ds_echo, command->first_argument, command->end, FALSE);
@ -2163,7 +2435,7 @@ int do_echo(struct st_command *command)
dynstr_append_mem(&ds_res, "\n", 1);
dynstr_free(&ds_echo);
command->last_argument= command->end;
return(0);
DBUG_RETURN(0);
}
@ -2459,7 +2731,6 @@ void do_let(struct st_command *command)
char *p= command->first_argument;
char *var_name, *var_name_end;
DYNAMIC_STRING let_rhs_expr;
DBUG_ENTER("do_let");
init_dynamic_string(&let_rhs_expr, "", 512, 2048);
@ -3139,7 +3410,7 @@ int connect_n_handle_errors(struct st_command *command,
void do_connect(struct st_command *command)
{
int con_port= port;
int con_port= opt_port;
char *con_options;
bool con_ssl= 0, con_compress= 0;
char *ptr;
@ -3275,13 +3546,12 @@ void do_connect(struct st_command *command)
/* Use default db name */
if (ds_database.length == 0)
dynstr_set(&ds_database, db);
dynstr_set(&ds_database, opt_db);
/* Special database to allow one to connect without a database name */
if (ds_database.length && !strcmp(ds_database.str,"*NO-ONE*"))
dynstr_set(&ds_database, "");
if (connect_n_handle_errors(command, &next_con->mysql,
ds_host.str,ds_user.str,
ds_password.str, ds_database.str,
@ -3705,7 +3975,7 @@ int read_line(char *buf, int size)
void convert_to_format_v1(char* query)
{
int last_c_was_quote= 0;
char *p= query, *write= query;
char *p= query, *to= query;
char *end= strend(query);
char last_c;
@ -3713,7 +3983,7 @@ void convert_to_format_v1(char* query)
{
if (*p == '\n' && !last_c_was_quote)
{
*write++ = *p++; /* Save the newline */
*to++ = *p++; /* Save the newline */
/* Skip any spaces on next line */
while (*p && my_isspace(charset_info, *p))
@ -3724,19 +3994,19 @@ void convert_to_format_v1(char* query)
else if (*p == '\'' || *p == '"' || *p == '`')
{
last_c= *p;
*write++ = *p++;
*to++ = *p++;
/* Copy anything until the next quote of same type */
while (*p && *p != last_c)
*write++ = *p++;
*to++ = *p++;
*write++ = *p++;
*to++ = *p++;
last_c_was_quote= 1;
}
else
{
*write++ = *p++;
*to++ = *p++;
last_c_was_quote= 0;
}
}
@ -3854,19 +4124,17 @@ void check_eol_junk(const char *eol)
Create a command from a set of lines
SYNOPSIS
read_command()
command_ptr pointer where to return the new query
read_command()
command_ptr pointer where to return the new query
DESCRIPTION
Converts lines returned by read_line into a command, this involves
parsing the first word in the read line to find the command type.
Converts lines returned by read_line into a command, this involves
parsing the first word in the read line to find the command type.
A -- comment may contain a valid query as the first word after the
comment start. Thus it's always checked to see if that is the case.
The advantage with this approach is to be able to execute commands
terminated by new line '\n' regardless how many "delimiter" it contain.
*/
#define MAX_QUERY (256*1024) /* 256K -- a test in sp-big is >128K */
@ -3952,7 +4220,7 @@ static struct my_option my_long_options[] =
{"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.",
(gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0,
{"database", 'D', "Database to use.", (gptr*) &opt_db, (gptr*) &opt_db, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
@ -3961,7 +4229,7 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0,
{"host", 'h', "Connect to host.", (gptr*) &opt_host, (gptr*) &opt_host, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"include", 'i', "Include SQL before each test case.", (gptr*) &opt_include,
(gptr*) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -3975,8 +4243,8 @@ static struct my_option my_long_options[] =
GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0},
{"password", 'p', "Password to use when connecting to server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", (gptr*) &port,
(gptr*) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_port,
(gptr*) &opt_port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ps-protocol", OPT_PS_PROTOCOL, "Use prepared statements protocol for communication",
(gptr*) &ps_protocol, (gptr*) &ps_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -4012,8 +4280,8 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't', "Temporary directory where sockets are put.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login.", (gptr*) &user, (gptr*) &user, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login.", (gptr*) &opt_user, (gptr*) &opt_user, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Write more.", (gptr*) &verbose, (gptr*) &verbose, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
@ -4140,8 +4408,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'p':
if (argument)
{
my_free(pass, MYF(MY_ALLOW_ZERO_PTR));
pass= my_strdup(argument, MYF(MY_FAE));
my_free(opt_pass, MYF(MY_ALLOW_ZERO_PTR));
opt_pass= my_strdup(argument, MYF(MY_FAE));
while (*argument) *argument++= 'x'; /* Destroy argument */
tty_password= 0;
}
@ -4178,7 +4446,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
exit(0);
case '?':
usage();
exit(1);
exit(0);
}
return 0;
}
@ -4198,13 +4466,47 @@ int parse_args(int argc, char **argv)
exit(1);
}
if (argc == 1)
db= *argv;
opt_db= *argv;
if (tty_password)
pass=get_tty_password(NullS);
opt_pass= get_tty_password(NullS); /* purify tested */
return 0;
}
/*
Write the content of str into file
SYNOPSIS
str_to_file2
fname - name of file to truncate/create and write to
str - content to write to file
size - size of content witten to file
append - append to file instead of overwriting old file
*/
void str_to_file2(const char *fname, char *str, int size, my_bool append)
{
int fd;
char buff[FN_REFLEN];
int flags= O_WRONLY | O_CREAT;
if (!test_if_hard_path(fname))
{
strxmov(buff, opt_basedir, fname, NullS);
fname= buff;
}
fn_format(buff, fname, "", "", MY_UNPACK_FILENAME);
if (!append)
flags|= O_TRUNC;
if ((fd= my_open(buff, flags,
MYF(MY_WME | MY_FFNF))) < 0)
die("Could not open %s: errno = %d", buff, errno);
if (append && my_seek(fd, 0, SEEK_END, MYF(0)) == MY_FILEPOS_ERROR)
die("Could not find end of file %s: errno = %d", buff, errno);
if (my_write(fd, (byte*)str, size, MYF(MY_WME|MY_FNABP)))
die("write failed");
my_close(fd, MYF(0));
}
/*
Write the content of str into file
@ -4218,21 +4520,7 @@ int parse_args(int argc, char **argv)
void str_to_file(const char *fname, char *str, int size)
{
int fd;
char buff[FN_REFLEN];
if (!test_if_hard_path(fname))
{
strxmov(buff, opt_basedir, fname, NullS);
fname= buff;
}
fn_format(buff, fname, "", "", MY_UNPACK_FILENAME);
if ((fd= my_open(buff, O_WRONLY | O_CREAT | O_TRUNC,
MYF(MY_WME | MY_FFNF))) < 0)
die("Could not open %s: errno = %d", buff, errno);
if (my_write(fd, (byte*)str, size, MYF(MY_WME|MY_FNABP)))
die("write failed");
my_close(fd, MYF(0));
str_to_file2(fname, str, size, FALSE);
}
@ -4483,13 +4771,13 @@ void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
MYSQL_FIELD *fields, uint num_fields)
{
MYSQL_BIND *bind;
MYSQL_BIND *my_bind;
my_bool *is_null;
ulong *length;
uint i;
/* Allocate array with bind structs, lengths and NULL flags */
bind= (MYSQL_BIND*) my_malloc(num_fields * sizeof(MYSQL_BIND),
my_bind= (MYSQL_BIND*) my_malloc(num_fields * sizeof(MYSQL_BIND),
MYF(MY_WME | MY_FAE | MY_ZEROFILL));
length= (ulong*) my_malloc(num_fields * sizeof(ulong),
MYF(MY_WME | MY_FAE));
@ -4500,25 +4788,25 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
for (i= 0; i < num_fields; i++)
{
uint max_length= fields[i].max_length + 1;
bind[i].buffer_type= MYSQL_TYPE_STRING;
bind[i].buffer= (char *)my_malloc(max_length, MYF(MY_WME | MY_FAE));
bind[i].buffer_length= max_length;
bind[i].is_null= &is_null[i];
bind[i].length= &length[i];
my_bind[i].buffer_type= MYSQL_TYPE_STRING;
my_bind[i].buffer= (char *)my_malloc(max_length, MYF(MY_WME | MY_FAE));
my_bind[i].buffer_length= max_length;
my_bind[i].is_null= &is_null[i];
my_bind[i].length= &length[i];
DBUG_PRINT("bind", ("col[%d]: buffer_type: %d, buffer_length: %lu",
i, bind[i].buffer_type, bind[i].buffer_length));
i, my_bind[i].buffer_type, my_bind[i].buffer_length));
}
if (mysql_stmt_bind_result(stmt, bind))
if (mysql_stmt_bind_result(stmt, my_bind))
die("mysql_stmt_bind_result failed: %d: %s",
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
while (mysql_stmt_fetch(stmt) == 0)
{
for (i= 0; i < num_fields; i++)
append_field(ds, i, &fields[i], (const char *) bind[i].buffer,
*bind[i].length, *bind[i].is_null);
append_field(ds, i, &fields[i], (const char *) my_bind[i].buffer,
*my_bind[i].length, *my_bind[i].is_null);
if (!display_result_vertically)
dynstr_append_mem(ds, "\n", 1);
}
@ -4530,10 +4818,10 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
for (i= 0; i < num_fields; i++)
{
/* Free data for output */
my_free((gptr)bind[i].buffer, MYF(MY_WME | MY_FAE));
my_free((gptr)my_bind[i].buffer, MYF(MY_WME | MY_FAE));
}
/* Free array with bind structs, lengths and NULL flags */
my_free((gptr)bind , MYF(MY_WME | MY_FAE));
my_free((gptr)my_bind , MYF(MY_WME | MY_FAE));
my_free((gptr)length , MYF(MY_WME | MY_FAE));
my_free((gptr)is_null , MYF(MY_WME | MY_FAE));
}
@ -4670,17 +4958,14 @@ int append_warnings(DYNAMIC_STRING *ds, MYSQL* mysql)
/*
Run query using MySQL C API
SYNPOSIS
run_query_normal
mysql - mysql handle
command - currrent command pointer
flags -flags indicating wheter to SEND and/or REAP
query - query string to execute
query_len - length query string to execute
ds - output buffer wherte to store result form query
RETURN VALUE
error - function will not return
SYNOPSIS
run_query_normal()
mysql mysql handle
command current command pointer
flags flags indicating if we should SEND and/or REAP
query query string to execute
query_len length query string to execute
ds output buffer where to store result form query
*/
void run_query_normal(struct st_connection *cn, struct st_command *command,
@ -5072,8 +5357,9 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
/*
If we got here the statement succeeded and was expected to do so,
get data. Note that this can still give errors found during execution!
Store the result of the query if if will return any fields
*/
if (mysql_stmt_store_result(stmt))
if (mysql_stmt_field_count(stmt) && mysql_stmt_store_result(stmt))
{
handle_error(command, mysql_stmt_errno(stmt),
mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds);
@ -5205,15 +5491,14 @@ int util_query(MYSQL* org_mysql, const char* query){
/*
Run query
SYNPOSIS
run_query()
mysql mysql handle
command currrent command pointer
flags control the phased/stages of query execution to be performed
if QUERY_SEND_FLAG bit is on, the query will be sent. If QUERY_REAP_FLAG
is on the result will be read - for regular query, both bits must be on
SYNPOSIS
run_query
mysql - mysql handle
command - currrent command pointer
*/
void run_query(struct st_connection *cn, struct st_command *command, int flags)
@ -5228,6 +5513,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
my_bool view_created= 0, sp_created= 0;
my_bool complete_query= ((flags & QUERY_SEND_FLAG) &&
(flags & QUERY_REAP_FLAG));
DBUG_ENTER("run_query");
init_dynamic_string(&ds_warnings, NULL, 0, 256);
@ -5393,7 +5679,6 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
if (command->require_file[0])
{
/* A result file was specified for _this_ query
and the output should be checked against an already
existing file which has been specified using --require or --result
@ -5406,6 +5691,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
dynstr_free(&ds_result);
if (command->type == Q_EVAL)
dynstr_free(&eval_query);
DBUG_VOID_RETURN;
}
/****************************************************************************/
@ -5670,7 +5956,11 @@ int main(int argc, char **argv)
parser.current_line= parser.read_lines= 0;
memset(&var_reg, 0, sizeof(var_reg));
init_builtin_echo();
#ifdef __WIN__
#ifndef USE_CYGWIN
is_windows= 1;
#endif
init_tmp_sh_file();
init_win_path_patterns();
#endif
@ -5733,8 +6023,8 @@ int main(int argc, char **argv)
if (!(cur_con->name = my_strdup("default", MYF(MY_WME))))
die("Out of memory");
safe_connect(&cur_con->mysql, cur_con->name, host, user, pass,
db, port, unix_sock);
safe_connect(&cur_con->mysql, cur_con->name, opt_host, opt_user, opt_pass,
opt_db, opt_port, unix_sock);
/* Use all time until exit if no explicit 'start_timer' */
timer_start= timer_now();
@ -5805,6 +6095,9 @@ int main(int argc, char **argv)
case Q_REMOVE_FILE: do_remove_file(command); break;
case Q_FILE_EXIST: do_file_exist(command); break;
case Q_WRITE_FILE: do_write_file(command); break;
case Q_APPEND_FILE: do_append_file(command); break;
case Q_DIFF_FILES: do_diff_files(command); break;
case Q_CAT_FILE: do_cat_file(command); break;
case Q_COPY_FILE: do_copy_file(command); break;
case Q_CHMOD_FILE: do_chmod_file(command); break;
case Q_PERL: do_perl(command); break;
@ -6101,8 +6394,6 @@ int main(int argc, char **argv)
if (result_file_name && ds_warning_messages.length)
dump_warning_messages();
dynstr_free(&ds_res);
timer_output();
free_used_memory();
my_end(MY_CHECK_ERROR);
@ -6313,7 +6604,8 @@ typedef struct st_replace_found {
void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds,
const char *str, int len)
const char *str,
int len __attribute__((unused)))
{
reg1 REPLACE *rep_pos;
reg2 REPLACE_STRING *rep_str;
@ -6704,7 +6996,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
we need at least what we have so far in the buffer + the part
before this match
*/
need_buf_len= (res_p - buf) + subs[0].rm_so;
need_buf_len= (res_p - buf) + (int) subs[0].rm_so;
/* on this pass, calculate the memory for the result buffer */
while (expr_p < replace_end)
@ -6714,17 +7006,17 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
if (c == '\\' && expr_p + 1 < replace_end)
{
back_ref_num= expr_p[1] - '0';
back_ref_num= (int) (expr_p[1] - '0');
}
/* found a valid back_ref (eg. \1)*/
if (back_ref_num >= 0 && back_ref_num <= (int)r.re_nsub)
{
int start_off,end_off;
regoff_t start_off, end_off;
if ((start_off=subs[back_ref_num].rm_so) > -1 &&
(end_off=subs[back_ref_num].rm_eo) > -1)
{
need_buf_len += (end_off - start_off);
need_buf_len += (int) (end_off - start_off);
}
expr_p += 2;
}
@ -6744,7 +7036,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
/* copy the pre-match part */
if (subs[0].rm_so)
{
memcpy(res_p, str_p, subs[0].rm_so);
memcpy(res_p, str_p, (size_t) subs[0].rm_so);
res_p+= subs[0].rm_so;
}
@ -6763,11 +7055,11 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
if (back_ref_num >= 0 && back_ref_num <= (int)r.re_nsub)
{
int start_off,end_off;
regoff_t start_off, end_off;
if ((start_off=subs[back_ref_num].rm_so) > -1 &&
(end_off=subs[back_ref_num].rm_eo) > -1)
{
int block_len= end_off - start_off;
int block_len= (int) (end_off - start_off);
memcpy(res_p,str_p + start_off, block_len);
res_p += block_len;
}

View File

@ -247,6 +247,10 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
0 No conversion needed
1 Either character set conversion or adding leading zeros
(e.g. for UCS-2) must be done
NOTE
to_cs may be NULL for "no conversion" if the system variable
character_set_results is NULL.
*/
bool String::needs_conversion(uint32 arg_length,
@ -255,7 +259,8 @@ bool String::needs_conversion(uint32 arg_length,
uint32 *offset)
{
*offset= 0;
if ((to_cs == &my_charset_bin) ||
if (!to_cs ||
(to_cs == &my_charset_bin) ||
(to_cs == from_cs) ||
my_charset_same(from_cs, to_cs) ||
((from_cs == &my_charset_bin) &&
@ -612,27 +617,26 @@ skip:
}
/*
** replace substring with string
** If wrong parameter or not enough memory, do nothing
Replace substring with string
If wrong parameter or not enough memory, do nothing
*/
bool String::replace(uint32 offset,uint32 arg_length,const String &to)
{
return replace(offset,arg_length,to.ptr(),to.length());
}
bool String::replace(uint32 offset,uint32 arg_length,
const char *to,uint32 length)
const char *to, uint32 to_length)
{
long diff = (long) length-(long) arg_length;
long diff = (long) to_length-(long) arg_length;
if (offset+arg_length <= str_length)
{
if (diff < 0)
{
if (length)
memcpy(Ptr+offset,to,length);
bmove(Ptr+offset+length,Ptr+offset+arg_length,
if (to_length)
memcpy(Ptr+offset,to,to_length);
bmove(Ptr+offset+to_length,Ptr+offset+arg_length,
str_length-offset-arg_length);
}
else
@ -644,8 +648,8 @@ bool String::replace(uint32 offset,uint32 arg_length,
bmove_upp(Ptr+str_length+diff,Ptr+str_length,
str_length-offset-arg_length);
}
if (length)
memcpy(Ptr+offset,to,length);
if (to_length)
memcpy(Ptr+offset,to,to_length);
}
str_length+=(uint32) diff;
}
@ -818,8 +822,18 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
from++;
wc= '?';
}
else if (cnvres > MY_CS_TOOSMALL)
{
/*
A correct multibyte sequence detected
But it doesn't have Unicode mapping.
*/
error_count++;
from+= (-cnvres);
wc= '?';
}
else
break; // Impossible char.
break; // Not enough characters
outp:
if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0)
@ -847,22 +861,22 @@ void String::print(String *str)
switch (c)
{
case '\\':
str->append("\\\\", 2);
str->append(STRING_WITH_LEN("\\\\"));
break;
case '\0':
str->append("\\0", 2);
str->append(STRING_WITH_LEN("\\0"));
break;
case '\'':
str->append("\\'", 2);
str->append(STRING_WITH_LEN("\\'"));
break;
case '\n':
str->append("\\n", 2);
str->append(STRING_WITH_LEN("\\n"));
break;
case '\r':
str->append("\\r", 2);
str->append(STRING_WITH_LEN("\\r"));
break;
case 26: //Ctrl-Z
str->append("\\z", 2);
str->append(STRING_WITH_LEN("\\z"));
break;
default:
str->append(c);

View File

@ -23,6 +23,8 @@
#define NOT_FIXED_DEC 31
#endif
#define STRING_WITH_LEN(X) ((const char*) X), ((uint) (sizeof(X) - 1))
class String;
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
@ -76,13 +78,15 @@ public:
{ /* never called */ }
~String() { free(); }
inline void set_charset(CHARSET_INFO *charset) { str_charset= charset; }
inline void set_charset(CHARSET_INFO *charset_arg)
{ str_charset= charset_arg; }
inline CHARSET_INFO *charset() const { return str_charset; }
inline uint32 length() const { return str_length;}
inline uint32 alloced_length() const { return Alloced_length;}
inline char& operator [] (uint32 i) const { return Ptr[i]; }
inline void length(uint32 len) { str_length=len ; }
inline bool is_empty() { return (str_length == 0); }
inline void mark_as_const() { Alloced_length= 0;}
inline const char *ptr() const { return Ptr; }
inline char *c_ptr()
{

View File

@ -426,7 +426,7 @@ rl_redisplay ()
#if defined (HANDLE_MULTIBYTE)
wchar_t wc;
size_t wc_bytes;
int wc_width;
int wc_width= 0;
mbstate_t ps;
int _rl_wrapped_multicolumn = 0;
#endif

View File

@ -560,12 +560,12 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
int c, l;
int chr, l;
l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY);
c = string[l];
chr = string[l];
/* XXX - original patch had i - 1 ??? If i == 0 it would fail. */
if (i && (c == '\'' || c == '"'))
quoted_search_delimiter = c;
if (i && (chr == '\'' || chr == '"'))
quoted_search_delimiter = chr;
}
else
#endif /* HANDLE_MULTIBYTE */

View File

@ -529,17 +529,17 @@ _rl_read_mbchar (mbchar, size)
may be FIRST. Used by the search functions, among others. Very similar
to _rl_read_mbchar. */
int
_rl_read_mbstring (first, mb, mblen)
_rl_read_mbstring (first, mb, mb_len)
int first;
char *mb;
int mblen;
int mb_len;
{
int i, c;
mbstate_t ps;
c = first;
memset (mb, 0, mblen);
for (i = 0; i < mblen; i++)
memset (mb, 0, mb_len);
for (i = 0; i < mb_len; i++)
{
mb[i] = (char)c;
memset (&ps, 0, sizeof (mbstate_t));

View File

@ -1002,12 +1002,12 @@ _rl_rubout_char (count, key)
}
else
{
int orig_point;
int orig_point2;
orig_point = rl_point;
orig_point2 = rl_point;
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
c = rl_line_buffer[rl_point];
rl_delete_text (rl_point, orig_point);
rl_delete_text (rl_point, orig_point2);
}
#endif /* HANDLE_MULTIBYTE */

View File

@ -672,7 +672,7 @@ _rl_vi_change_mbchar_case (count)
{
wchar_t wc;
char mb[MB_LEN_MAX+1];
int mblen;
int local_mblen;
mbstate_t ps;
memset (&ps, 0, sizeof (mbstate_t));
@ -695,9 +695,9 @@ _rl_vi_change_mbchar_case (count)
/* Vi is kind of strange here. */
if (wc)
{
mblen = wcrtomb (mb, wc, &ps);
if (mblen >= 0)
mb[mblen] = '\0';
local_mblen = wcrtomb (mb, wc, &ps);
if (local_mblen >= 0)
mb[local_mblen] = '\0';
rl_begin_undo_group ();
rl_delete (1, 0);
rl_insert_text (mb);

View File

@ -39,8 +39,7 @@
/* **************************************************************** */
static void
memory_error_and_abort (fname)
char *fname;
memory_error_and_abort(const char *fname)
{
fprintf (stderr, "%s: out of virtual memory\n", fname);
exit (2);
@ -57,7 +56,7 @@ xmalloc (bytes)
temp = malloc (bytes);
if (temp == 0)
memory_error_and_abort ("xmalloc");
memory_error_and_abort("xmalloc");
return (temp);
}
@ -71,7 +70,7 @@ xrealloc (pointer, bytes)
temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
if (temp == 0)
memory_error_and_abort ("xrealloc");
memory_error_and_abort("xrealloc");
return (temp);
}

View File

@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.0.36)
AM_INIT_AUTOMAKE(mysql, 5.0.38)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
# ndb version
NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=0
NDB_VERSION_BUILD=36
NDB_VERSION_BUILD=38
NDB_VERSION_STATUS=""
# Set all version vars based on $VERSION. How do we do this more elegant ?
@ -1090,7 +1090,7 @@ case $SYSTEM_TYPE in
*darwin6*)
if test "$ac_cv_prog_gcc" = "yes"
then
FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DDONT_DECLARE_CXA_PURE_VIRTUAL "
CFLAGS="$CFLAGS $FLAGS"
CXXFLAGS="$CXXFLAGS $FLAGS"
MAX_C_OPTIMIZE="-O"

View File

@ -309,7 +309,7 @@ FILE *inf;
unsigned long fn_ssz;
unsigned long lastuse;
unsigned int pos;
unsigned long time;
unsigned long local_time;
unsigned int oldpos;
unsigned long oldtime;
unsigned long oldchild;
@ -335,15 +335,15 @@ FILE *inf;
*/
while (pop (&oldpos, &oldtime, &oldchild)) {
DBUG_PRINT ("popped", ("%lu %lu", oldtime, oldchild));
time = fn_time - oldtime;
local_time = fn_time - oldtime;
t = top ();
t -> children += time;
t -> children += local_time;
DBUG_PRINT ("update", ("%s", modules[t -> pos].name));
DBUG_PRINT ("update", ("%lu", t -> children));
time -= oldchild;
modules[oldpos].m_time += time;
local_time -= oldchild;
modules[oldpos].m_time += local_time;
modules[oldpos].m_calls++;
tot_time += time;
tot_time += local_time;
tot_calls++;
if (pos == oldpos) {
goto next_line; /* Should be a break2 */
@ -355,11 +355,11 @@ FILE *inf;
* it so that it works the next time too.
*/
t = top ();
time = fn_time - t -> time - t -> children;
local_time = fn_time - t -> time - t -> children;
t -> time = fn_time; t -> children = 0;
modules[pos].m_time += time;
modules[pos].m_time += local_time;
modules[pos].m_calls++;
tot_time += time;
tot_time += local_time;
tot_calls++;
break;
case 'S':
@ -405,13 +405,13 @@ FILE *inf;
* time of fn_time.
*/
while (pop (&oldpos,&oldtime,&oldchild)) {
time = fn_time - oldtime;
local_time = fn_time - oldtime;
t = top ();
t -> children += time;
time -= oldchild;
modules[oldpos].m_time += time;
t -> children += local_time;
local_time -= oldchild;
modules[oldpos].m_time += local_time;
modules[oldpos].m_calls++;
tot_time += time;
tot_time += local_time;
tot_calls++;
}
DBUG_VOID_RETURN;
@ -472,17 +472,17 @@ unsigned long int *called, *timed;
{
char *name = m -> name;
register unsigned int calls = m -> m_calls;
register unsigned long time = m -> m_time;
register unsigned long local_time = m -> m_time;
register unsigned long stkuse = m -> m_stkuse;
unsigned int import;
double per_time = 0.0;
double per_calls = 0.0;
double ms_per_call, ftime;
double ms_per_call, local_ftime;
DBUG_ENTER ("out_item");
if (tot_time > 0) {
per_time = (double) (time * 100) / (double) tot_time;
per_time = (double) (local_time * 100) / (double) tot_time;
}
if (tot_calls > 0) {
per_calls = (double) (calls * 100) / (double) tot_calls;
@ -491,18 +491,18 @@ unsigned long int *called, *timed;
if (verbose) {
fprintf (outf, "%6d\t%10.2f\t%11ld\t%10.2f %10d\t%-15s\n",
calls, per_calls, time, per_time, import, name);
calls, per_calls, local_time, per_time, import, name);
} else {
ms_per_call = time;
ms_per_call = local_time;
ms_per_call /= calls;
ftime = time;
ftime /= 1000;
local_ftime = local_time;
local_ftime /= 1000;
fprintf(outf, "%8.2f%8.3f%8u%8.3f%8.2f%8u%8lu %-s\n",
per_time, ftime, calls, ms_per_call, per_calls, import,
per_time, local_ftime, calls, ms_per_call, per_calls, import,
stkuse, name);
}
*called = calls;
*timed = time;
*timed = local_time;
DBUG_VOID_RETURN;
}
@ -517,7 +517,7 @@ FILE *outf;
register unsigned int root;
register unsigned long int *s_calls, *s_time;
{
unsigned long int calls, time;
unsigned long int calls, local_time;
DBUG_ENTER ("out_body");
DBUG_PRINT ("out_body", ("%lu,%lu",*s_calls,*s_time));
@ -526,10 +526,10 @@ register unsigned long int *s_calls, *s_time;
} else {
while (root != MAXPROCS) {
out_body (outf, s_table[root].lchild,s_calls,s_time);
out_item (outf, &modules[s_table[root].pos],&calls,&time);
DBUG_PRINT ("out_body", ("-- %lu -- %lu --", calls, time));
out_item (outf, &modules[s_table[root].pos],&calls,&local_time);
DBUG_PRINT ("out_body", ("-- %lu -- %lu --", calls, local_time));
*s_calls += calls;
*s_time += time;
*s_time += local_time;
root = s_table[root].rchild;
}
DBUG_PRINT ("out_body", ("%lu,%lu", *s_calls, *s_time));

View File

@ -19,7 +19,7 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_EXECUTABLE(comp_err comp_err.c)
TARGET_LINK_LIBRARIES(comp_err dbug mysys strings wsock32)
TARGET_LINK_LIBRARIES(comp_err dbug mysys strings zlib wsock32)
GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION)

View File

@ -16,7 +16,8 @@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
@ndbcluster_includes@ -I$(top_srcdir)/sql
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
../dbug/libdbug.a ../strings/libmystrings.a
../dbug/libdbug.a ../strings/libmystrings.a \
$(ZLIB_LIBS)
BUILT_SOURCES= $(top_builddir)/include/mysqld_error.h \
$(top_builddir)/include/sql_state.h \
$(top_builddir)/include/mysqld_ername.h

View File

@ -41,7 +41,9 @@ static char *NAMEFILE= (char*) "mysqld_ername.h";
static char *STATEFILE= (char*) "sql_state.h";
static char *TXTFILE= (char*) "../sql/share/errmsg.txt";
static char *DATADIRECTORY= (char*) "../sql/share/";
#ifndef DBUG_OFF
static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace";
#endif
/* Header for errmsg.sys files */
uchar file_head[]= { 254, 254, 2, 1 };
@ -132,6 +134,8 @@ static struct message *parse_message_string(struct message *new_message,
char *str);
static struct message *find_message(struct errors *err, const char *lang,
my_bool no_default);
static int check_message_format(struct errors *err,
const char* mess);
static int parse_input_file(const char *file_name, struct errors **top_error,
struct languages **top_language);
static int get_options(int *argc, char ***argv);
@ -402,6 +406,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
int rcount= 0;
DBUG_ENTER("parse_input_file");
*top_error= 0;
*top_lang= 0;
if (!(file= my_fopen(file_name, O_RDONLY | O_SHARE, MYF(MY_WME))))
DBUG_RETURN(0);
@ -458,6 +464,13 @@ static int parse_input_file(const char *file_name, struct errors **top_error,
current_error->er_name, current_message.lang_short_name);
DBUG_RETURN(0);
}
if (check_message_format(current_error, current_message.text))
{
fprintf(stderr, "Wrong formatspecifier of error message string"
" for error '%s' in language '%s'\n",
current_error->er_name, current_message.lang_short_name);
DBUG_RETURN(0);
}
if (insert_dynamic(&current_error->msg, (byte *) & current_message))
DBUG_RETURN(0);
continue;
@ -599,6 +612,116 @@ static struct message *find_message(struct errors *err, const char *lang,
}
/*
Check message format specifiers against error message for
previous language
SYNOPSIS
checksum_format_specifier()
msg String for which to generate checksum
for the format specifiers
RETURN VALUE
Returns the checksum for all the characters of the
format specifiers
Ex.
"text '%-64.s' text part 2 %d'"
^^^^^^ ^^
characters will be xored to form checksum
NOTE:
Does not support format specifiers with positional args
like "%2$s" but that is not yet supported by my_vsnprintf
either.
*/
static ha_checksum checksum_format_specifier(const char* msg)
{
ha_checksum chksum= 0;
const char* p= msg;
const char* start= 0;
int num_format_specifiers= 0;
while (*p)
{
if (*p == '%')
{
start= p+1; /* Entering format specifier */
num_format_specifiers++;
}
else if (start)
{
switch(*p)
{
case 'd':
case 'u':
case 'x':
case 's':
chksum= my_checksum(chksum, start, p-start);
start= 0; /* Not in format specifier anymore */
break;
default:
break;
}
}
p++;
}
if (start)
{
/* Still inside a format specifier after end of string */
fprintf(stderr, "Still inside formatspecifier after end of string"
" in'%s'\n", msg);
DBUG_ASSERT(start==0);
}
/* Add number of format specifiers to checksum as extra safeguard */
chksum+= num_format_specifiers;
return chksum;
}
/*
Check message format specifiers against error message for
previous language
SYNOPSIS
check_message_format()
err Error to check message for
mess Message to check
RETURN VALUE
Returns 0 if no previous error message or message format is ok
*/
static int check_message_format(struct errors *err,
const char* mess)
{
struct message *first;
DBUG_ENTER("check_message_format");
/* Get first message(if any) */
if ((err->msg).elements == 0)
DBUG_RETURN(0); /* No previous message to compare against */
first= dynamic_element(&err->msg, 0, struct message*);
DBUG_ASSERT(first != NULL);
if (checksum_format_specifier(first->text) !=
checksum_format_specifier(mess))
{
/* Check sum of format specifiers failed, they should be equal */
DBUG_RETURN(1);
}
DBUG_RETURN(0);
}
/*
Skips spaces and or tabs till the beginning of the next word
Returns pointer to the beginning of the first character of the word

View File

@ -48,15 +48,16 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0, 0},
{"defaults-extra-file", 'e',
"Read this file after the global /etc config file and before the config file in the users home directory.",
(gptr*) &defaults_extra_file, (gptr*) &defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
(gptr*) &my_defaults_extra_file, (gptr*) &my_defaults_extra_file, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"defaults-group-suffix", 'g',
"In addition to the given groups, read also groups with this suffix",
(gptr*) &defaults_group_suffix, (gptr*) &defaults_group_suffix,
(gptr*) &my_defaults_group_suffix, (gptr*) &my_defaults_group_suffix,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extra-file", 'e',
"Synonym for --defaults-extra-file.",
(gptr*) &defaults_extra_file, (gptr*) &defaults_extra_file, 0, GET_STR,
(gptr*) &my_defaults_extra_file,
(gptr*) &my_defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"no-defaults", 'n', "Return an empty string (useful for scripts).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},

View File

@ -49,11 +49,13 @@ const uint AUTO = 0xFEEDBEEF;
// Checking Policy should implement a check function that tests whether the
// index is within the size limit of the array
struct Check {
Check() {}
void check(uint i, uint limit);
};
struct NoCheck {
NoCheck() {}
void check(uint, uint);
};
@ -191,6 +193,7 @@ inline void checked_delete(T* p)
// sets pointer to zero so safe for std conatiners
struct del_ptr_zero
{
del_ptr_zero() {}
template <typename T>
void operator()(T*& p) const
{

View File

@ -42,6 +42,7 @@ namespace yaSSL {
// Digest policy should implement a get_digest, update, and get sizes for pad
// and digest
struct Digest : public virtual_base {
Digest() {}
virtual void get_digest(byte*) = 0;
virtual void get_digest(byte*, const byte*, unsigned int) = 0;
virtual void update(const byte*, unsigned int) = 0;
@ -53,6 +54,7 @@ struct Digest : public virtual_base {
// For use with NULL Digests
struct NO_MAC : public Digest {
NO_MAC() {}
void get_digest(byte*);
void get_digest(byte*, const byte*, unsigned int);
void update(const byte*, unsigned int);
@ -177,6 +179,7 @@ private:
// BulkCipher policy should implement encrypt, decrypt, get block size,
// and set keys for encrypt and decrypt
struct BulkCipher : public virtual_base {
BulkCipher() {}
virtual void encrypt(byte*, const byte*, unsigned int) = 0;
virtual void decrypt(byte*, const byte*, unsigned int) = 0;
virtual void set_encryptKey(const byte*, const byte* = 0) = 0;
@ -190,6 +193,7 @@ struct BulkCipher : public virtual_base {
// For use with NULL Ciphers
struct NO_Cipher : public BulkCipher {
NO_Cipher() {}
void encrypt(byte*, const byte*, unsigned int) {}
void decrypt(byte*, const byte*, unsigned int) {}
void set_encryptKey(const byte*, const byte*) {}
@ -311,12 +315,14 @@ struct Auth : public virtual_base {
virtual bool verify(const byte*, unsigned int, const byte*,
unsigned int) = 0;
virtual uint get_signatureLength() const = 0;
Auth() {}
virtual ~Auth() {}
};
// For use with NULL Authentication schemes
struct NO_Auth : public Auth {
NO_Auth() {}
void sign(byte*, const byte*, unsigned int, const RandomPool&) {}
bool verify(const byte*, unsigned int, const byte*, unsigned int)
{ return true; }

View File

@ -33,7 +33,6 @@
#include "opensslv.h" /* for version number */
#include "rsa.h"
#define YASSL_VERSION "1.5.8"
@ -190,11 +189,16 @@ enum { /* ERR Constants */
EVP_R_BAD_DECRYPT = 2
};
#ifdef WIN
typedef SOCKET socket_t;
#else
typedef int socket_t;
#endif
SSL_CTX* SSL_CTX_new(SSL_METHOD*);
SSL* SSL_new(SSL_CTX*);
int SSL_set_fd (SSL*, int);
int SSL_set_fd (SSL*, socket_t);
int SSL_connect(SSL*);
int SSL_write(SSL*, const void*, int);
int SSL_read(SSL*, void*, int);

View File

@ -38,16 +38,14 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
#include "openssl/ssl.h" /* for socket_t */
namespace yaSSL {
typedef unsigned int uint;
#ifdef _WIN32
typedef SOCKET socket_t;
#else
typedef int socket_t;
#ifndef _WIN32
const socket_t INVALID_SOCKET = -1;
const int SD_RECEIVE = 0;
const int SD_SEND = 1;

View File

@ -64,6 +64,7 @@ struct RecordLayerHeader {
// base for all messages
struct Message : public virtual_base {
Message() {}
virtual input_buffer& set(input_buffer&) =0;
virtual output_buffer& get(output_buffer&) const =0;
@ -177,6 +178,7 @@ private:
class HandShakeBase : public virtual_base {
int length_;
public:
HandShakeBase() {}
int get_length() const;
void set_length(int);
@ -194,6 +196,7 @@ public:
struct HelloRequest : public HandShakeBase {
HelloRequest() {}
input_buffer& set(input_buffer& in);
output_buffer& get(output_buffer& out) const;
@ -327,6 +330,7 @@ private:
struct ServerKeyBase : public virtual_base {
ServerKeyBase() {}
virtual ~ServerKeyBase() {}
virtual void build(SSL&) {}
virtual void read(SSL&, input_buffer&) {}
@ -337,15 +341,21 @@ struct ServerKeyBase : public virtual_base {
// Server random number for FORTEZZA KEA
struct Fortezza_Server : public ServerKeyBase {
Fortezza_Server() {}
opaque r_s_[FORTEZZA_MAX];
};
struct SignatureBase : public virtual_base {
SignatureBase() {}
virtual ~SignatureBase() {}
};
struct anonymous_sa : public SignatureBase {};
struct anonymous_sa : public SignatureBase
{
public:
anonymous_sa() {}
};
struct Hashes {
@ -355,11 +365,13 @@ struct Hashes {
struct rsa_sa : public SignatureBase {
rsa_sa() {}
Hashes hashes_;
};
struct dsa_sa : public SignatureBase {
dsa_sa() {}
uint8 sha_[SHA_LEN];
};
@ -387,6 +399,7 @@ private:
// Server's RSA exchange
struct RSA_Server : public ServerKeyBase {
RSA_Server() {}
ServerRSAParams params_;
opaque* signature_; // signed rsa_sa hashes
};
@ -461,6 +474,7 @@ struct PreMasterSecret {
struct ClientKeyBase : public virtual_base {
ClientKeyBase() {}
virtual ~ClientKeyBase() {}
virtual void build(SSL&) {}
virtual void read(SSL&, input_buffer&) {}
@ -491,6 +505,7 @@ private:
// Fortezza Key Parameters from page 29
// hard code lengths cause only used here
struct FortezzaKeys : public ClientKeyBase {
FortezzaKeys() {}
opaque y_c_ [128]; // client's Yc, public value
opaque r_c_ [128]; // client's Rc
opaque y_signature_ [40]; // DSS signed public key

View File

@ -228,6 +228,7 @@ struct BIGNUM {
TaoCrypt::Integer), we need to explicitly state the namespace
here to let gcc 2.96 deduce the correct type.
*/
BIGNUM() {}
yaSSL::Integer int_;
void assign(const byte* b, uint s) { int_.assign(b,s); }
};

View File

@ -550,6 +550,7 @@ void RandomPool::Fill(opaque* dst, uint sz) const
// Implementation of DSS Authentication
struct DSS::DSSImpl {
DSSImpl() {}
void SetPublic (const byte*, unsigned int);
void SetPrivate(const byte*, unsigned int);
TaoCrypt::DSA_PublicKey publicKey_;
@ -622,6 +623,7 @@ bool DSS::verify(const byte* sha_digest, unsigned int /* shaSz */,
// Implementation of RSA key interface
struct RSA::RSAImpl {
RSAImpl() {}
void SetPublic (const byte*, unsigned int);
void SetPrivate(const byte*, unsigned int);
TaoCrypt::RSA_PublicKey publicKey_;

View File

@ -229,7 +229,7 @@ void SSL_free(SSL* ssl)
}
int SSL_set_fd(SSL* ssl, int fd)
int SSL_set_fd(SSL* ssl, socket_t fd)
{
ssl->useSocket().set_fd(fd);
return SSL_SUCCESS;
@ -950,7 +950,7 @@ void ERR_print_errors_fp(FILE* /*fp*/)
char* ERR_error_string(unsigned long errNumber, char* buffer)
{
static char* msg = "Please supply a buffer for error string";
static char* msg = (char*) "Please supply a buffer for error string";
if (buffer) {
SetErrorString(YasslError(errNumber), buffer);

View File

@ -65,7 +65,7 @@ int main(int argc, char** argv)
const int megs = 5; // how much to test
const byte key[] =
const byte global_key[] =
{
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10,
@ -81,19 +81,19 @@ const byte iv[] =
};
byte plain [1024*1024];
byte cipher[1024*1024];
byte global_plain [1024*1024];
byte global_cipher[1024*1024];
void bench_des()
{
DES_EDE3_CBC_Encryption enc;
enc.SetKey(key, 16, iv);
enc.SetKey(global_key, 16, iv);
double start = current_time();
for(int i = 0; i < megs; i++)
enc.Process(plain, cipher, sizeof(plain));
enc.Process(global_plain, global_cipher, sizeof(global_plain));
double total = current_time() - start;
@ -107,12 +107,12 @@ void bench_des()
void bench_aes(bool show)
{
AES_CBC_Encryption enc;
enc.SetKey(key, 16, iv);
enc.SetKey(global_key, 16, iv);
double start = current_time();
for(int i = 0; i < megs; i++)
enc.Process(plain, cipher, sizeof(plain));
enc.Process(global_plain, global_cipher, sizeof(global_plain));
double total = current_time() - start;
@ -127,12 +127,12 @@ void bench_aes(bool show)
void bench_twofish()
{
Twofish_CBC_Encryption enc;
enc.SetKey(key, 16, iv);
enc.SetKey(global_key, 16, iv);
double start = current_time();
for(int i = 0; i < megs; i++)
enc.Process(plain, cipher, sizeof(plain));
enc.Process(global_plain, global_cipher, sizeof(global_plain));
double total = current_time() - start;
@ -147,12 +147,12 @@ void bench_twofish()
void bench_blowfish()
{
Blowfish_CBC_Encryption enc;
enc.SetKey(key, 16, iv);
enc.SetKey(global_key, 16, iv);
double start = current_time();
for(int i = 0; i < megs; i++)
enc.Process(plain, cipher, sizeof(plain));
enc.Process(global_plain, global_cipher, sizeof(global_plain));
double total = current_time() - start;
@ -166,12 +166,12 @@ void bench_blowfish()
void bench_arc4()
{
ARC4 enc;
enc.SetKey(key, 16);
enc.SetKey(global_key, 16);
double start = current_time();
for(int i = 0; i < megs; i++)
enc.Process(cipher, plain, sizeof(plain));
enc.Process(global_cipher, global_plain, sizeof(global_plain));
double total = current_time() - start;
@ -191,7 +191,7 @@ void bench_md5()
for(int i = 0; i < megs; i++)
hash.Update(plain, sizeof(plain));
hash.Update(global_plain, sizeof(global_plain));
hash.Final(digest);
@ -213,7 +213,7 @@ void bench_sha()
for(int i = 0; i < megs; i++)
hash.Update(plain, sizeof(plain));
hash.Update(global_plain, sizeof(global_plain));
hash.Final(digest);
@ -241,7 +241,7 @@ void bench_ripemd()
for(int i = 0; i < megs; i++)
hash.Update(plain, sizeof(plain));
hash.Update(global_plain, sizeof(global_plain));
hash.Final(digest);

View File

@ -40,6 +40,7 @@ class TAOCRYPT_NO_VTABLE AbstractGroup : public virtual_base
public:
typedef Integer Element;
AbstractGroup() {}
virtual ~AbstractGroup() {}
virtual bool Equal(const Element &a, const Element &b) const =0;
@ -94,6 +95,7 @@ private:
class MultiplicativeGroupT : public AbstractGroup
{
public:
MultiplicativeGroupT() {}
const AbstractRing& GetRing() const
{return *m_pRing;}
@ -145,6 +147,7 @@ class TAOCRYPT_NO_VTABLE AbstractEuclideanDomain
: public AbstractRing
{
public:
AbstractEuclideanDomain() {}
typedef Integer Element;
virtual void DivisionAlgorithm(Element &r, Element &q, const Element &a,

View File

@ -41,6 +41,7 @@ enum { DES_BLOCK_SIZE = 8, DES_KEY_SIZE = 32 };
class BasicDES {
public:
BasicDES() {}
void SetKey(const byte*, word32, CipherDir dir);
void RawProcessBlock(word32&, word32&) const;
protected:

View File

@ -31,6 +31,7 @@ namespace TaoCrypt {
// HASH
class HASH : public virtual_base {
public:
HASH() {}
virtual ~HASH() {}
virtual void Update(const byte*, word32) = 0;

View File

@ -109,11 +109,11 @@ void HMAC<T>::KeyInnerHash()
// Update
template <class T>
void HMAC<T>::Update(const byte* msg, word32 length)
void HMAC<T>::Update(const byte* msg_arg, word32 length)
{
if (!innerHashKeyed_)
KeyInnerHash();
mac_.Update(msg, length);
mac_.Update(msg_arg, length);
}

View File

@ -858,9 +858,9 @@ inline T1 SaturatingSubtract(T1 a, T2 b)
// declares
unsigned int BytePrecision(unsigned long value);
unsigned int BitPrecision(unsigned long);
unsigned long Crop(unsigned long value, unsigned int size);
unsigned int BytePrecision(word value);
unsigned int BitPrecision(word);
word Crop(word value, unsigned int size);

View File

@ -37,8 +37,8 @@ public:
typedef int RandomizationParameter;
typedef Integer Element;
ModularArithmetic(const Integer &modulus = Integer::One())
: modulus(modulus), result((word)0, modulus.reg_.size()) {}
ModularArithmetic(const Integer &modulus_arg = Integer::One())
: modulus(modulus_arg), result((word)0, modulus_arg.reg_.size()) {}
ModularArithmetic(const ModularArithmetic &ma)
: AbstractRing(),

View File

@ -42,8 +42,8 @@ public:
{ cipher_.Process(c, p, sz); }
void SetKey(const byte* k, word32 sz)
{ cipher_.SetKey(k, sz, DIR); }
void SetKey(const byte* k, word32 sz, const byte* iv)
{ cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv); }
void SetKey(const byte* k, word32 sz, const byte* iv_arg)
{ cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv_arg); }
private:
T cipher_;

View File

@ -131,6 +131,7 @@ private:
// block type 2 padding
class RSA_BlockType2 {
public:
RSA_BlockType2() {}
void Pad(const byte*, word32, byte*, word32,
RandomNumberGenerator&) const;
word32 UnPad(const byte*, word32, byte*) const;
@ -140,6 +141,7 @@ public:
// block type 1 padding
class RSA_BlockType1 {
public:
RSA_BlockType1() {}
void Pad(const byte*, word32, byte*, word32,
RandomNumberGenerator&) const;
word32 UnPad(const byte*, word32, byte*) const;
@ -174,25 +176,27 @@ public:
// Public Encrypt
template<class Pad>
void RSA_Encryptor<Pad>::Encrypt(const byte* plain, word32 sz, byte* cipher,
RandomNumberGenerator& rng)
void RSA_Encryptor<Pad>::Encrypt(const byte* plain_arg, word32 sz,
byte* cipher_arg,
RandomNumberGenerator& rng_arg)
{
PK_Lengths lengths(key_.GetModulus());
assert(sz <= lengths.FixedMaxPlaintextLength());
ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
padding_.Pad(plain, sz, paddedBlock.get_buffer(),
lengths.PaddedBlockBitLength(), rng);
padding_.Pad(plain_arg, sz, paddedBlock.get_buffer(),
lengths.PaddedBlockBitLength(), rng_arg);
key_.ApplyFunction(Integer(paddedBlock.get_buffer(), paddedBlock.size())).
Encode(cipher, lengths.FixedCiphertextLength());
Encode(cipher_arg, lengths.FixedCiphertextLength());
}
// Private Decrypt
template<class Pad>
word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain,
RandomNumberGenerator& rng)
word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher_arg, word32 sz,
byte* plain_arg,
RandomNumberGenerator& rng_arg)
{
PK_Lengths lengths(key_.GetModulus());
assert(sz == lengths.FixedCiphertextLength());
@ -201,29 +205,29 @@ word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain,
return 0;
ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
Integer x = key_.CalculateInverse(rng, Integer(cipher,
Integer x = key_.CalculateInverse(rng_arg, Integer(cipher_arg,
lengths.FixedCiphertextLength()).Ref());
if (x.ByteCount() > paddedBlock.size())
x = Integer::Zero(); // don't return false, prevents timing attack
x.Encode(paddedBlock.get_buffer(), paddedBlock.size());
return padding_.UnPad(paddedBlock.get_buffer(),
lengths.PaddedBlockBitLength(), plain);
lengths.PaddedBlockBitLength(), plain_arg);
}
// Private SSL type (block 1) Encrypt
template<class Pad>
void RSA_Decryptor<Pad>::SSL_Sign(const byte* message, word32 sz, byte* sig,
RandomNumberGenerator& rng)
RandomNumberGenerator& rng_arg)
{
RSA_PublicKey inverse;
inverse.Initialize(key_.GetModulus(), key_.GetPrivateExponent());
RSA_Encryptor<RSA_BlockType1> enc(inverse); // SSL Type
enc.Encrypt(message, sz, sig, rng);
enc.Encrypt(message, sz, sig, rng_arg);
}
word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain);
word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain_arg);
// Public SSL type (block 1) Decrypt
@ -231,11 +235,11 @@ template<class Pad>
bool RSA_Encryptor<Pad>::SSL_Verify(const byte* message, word32 sz,
const byte* sig)
{
ByteBlock plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength());
if (SSL_Decrypt(key_, sig, plain.get_buffer()) != sz)
ByteBlock local_plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength());
if (SSL_Decrypt(key_, sig, local_plain.get_buffer()) != sz)
return false; // not right justified or bad padding
if ( (memcmp(plain.get_buffer(), message, sz)) == 0)
if ( (memcmp(local_plain.get_buffer(), message, sz)) == 0)
return true;
return false;
}

View File

@ -62,7 +62,11 @@ MK_FUNDAMENTAL_TYPE(unsigned long)
MK_FUNDAMENTAL_TYPE(float)
MK_FUNDAMENTAL_TYPE( double)
MK_FUNDAMENTAL_TYPE(long double)
#ifdef LONG_DOUBLE_IS_DISTINCT_TYPE
// Don't define by default as this gives warnings on power mac
MK_FUNDAMENTAL_TYPE(long double)
#endif
#if defined(WORD64_AVAILABLE) && defined(WORD64_IS_DISTINCT_TYPE)
MK_FUNDAMENTAL_TYPE(word64)

View File

@ -231,7 +231,7 @@ void list<T>::push_front(T t)
template<typename T>
void list<T>::pop_front()
{
node* front = head_;
node* local_front = head_;
if (head_ == 0)
return;
@ -241,8 +241,8 @@ void list<T>::pop_front()
head_ = head_->next_;
head_->prev_ = 0;
}
destroy(front);
FreeMemory(front);
destroy(local_front);
FreeMemory(local_front);
--sz_;
}
@ -303,13 +303,13 @@ T list<T>::back() const
template<typename T>
typename list<T>::node* list<T>::look_up(T t)
{
node* list = head_;
node* local_list = head_;
if (list == 0) return 0;
if (local_list == 0) return 0;
for (; list; list = list->next_)
if (list->value_ == t)
return list;
for (; local_list; local_list = local_list->next_)
if (local_list->value_ == t)
return local_list;
return 0;
}

View File

@ -90,13 +90,14 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
rounds_ = keylen/4 + 6;
word32 temp, *rk = key_;
unsigned int i=0;
GetUserKey(BigEndianOrder, rk, keylen/4, userKey, keylen);
switch(keylen)
{
case 16:
{
unsigned int i=0;
while (true)
{
temp = rk[3];
@ -114,8 +115,10 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
rk += 4;
}
break;
}
case 24:
{
unsigned int i=0;
while (true) // for (;;) here triggers a bug in VC60 SP4 w/ Pro Pack
{
temp = rk[ 5];
@ -136,7 +139,10 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
}
break;
}
case 32:
{
unsigned int i=0;
while (true)
{
temp = rk[ 7];
@ -165,6 +171,7 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
}
break;
}
}
if (dir_ == DECRYPTION)
{

View File

@ -186,10 +186,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x,
struct WindowSlider
{
WindowSlider(const Integer &exp, bool fastNegate,
WindowSlider(const Integer &exp_arg, bool fastNegate_arg,
unsigned int windowSizeIn=0)
: exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn),
windowBegin(0), fastNegate(fastNegate), firstTime(true),
: exp(exp_arg), windowModulus(Integer::One()), windowSize(windowSizeIn),
windowBegin(0), fastNegate(fastNegate_arg), firstTime(true),
finished(false)
{
if (windowSize == 0)

View File

@ -737,17 +737,17 @@ void CertDecoder::GetName(NameType nt)
email = true;
source_.advance(oidSz + 1);
word32 length = GetLength(source_);
word32 length2 = GetLength(source_);
if (email) {
memcpy(&ptr[idx], "/emailAddress=", 14);
idx += 14;
memcpy(&ptr[idx], source_.get_current(), length);
idx += length;
memcpy(&ptr[idx], source_.get_current(), length2);
idx += length2;
}
source_.advance(length);
source_.advance(length2);
}
}
ptr[idx++] = 0;

View File

@ -3390,7 +3390,7 @@ void Integer::DivideByPowerOf2(Integer &r, Integer &q, const Integer &a,
CopyWords(r.reg_.get_buffer(), a.reg_.get_buffer(), wordCount);
SetWords(r.reg_+wordCount, 0, r.reg_.size()-wordCount);
if (n % WORD_BITS != 0)
r.reg_[wordCount-1] %= (1 << (n % WORD_BITS));
r.reg_[wordCount-1] %= ((word) 1 << (n % WORD_BITS));
}
else
{

View File

@ -122,7 +122,7 @@ void xorbuf(byte* buf, const byte* mask, unsigned int count)
}
unsigned int BytePrecision(unsigned long value)
unsigned int BytePrecision(word value)
{
unsigned int i;
for (i=sizeof(value); i; --i)
@ -133,7 +133,7 @@ unsigned int BytePrecision(unsigned long value)
}
unsigned int BitPrecision(unsigned long value)
unsigned int BitPrecision(word value)
{
if (!value)
return 0;
@ -154,7 +154,7 @@ unsigned int BitPrecision(unsigned long value)
}
unsigned long Crop(unsigned long value, unsigned int size)
word Crop(word value, unsigned int size)
{
if (size < 8*sizeof(value))
return (value & ((1L << size) - 1));

View File

@ -139,20 +139,20 @@ const byte msgTmp[] = { // "now is the time for all " w/o trailing 0
0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
};
byte* msg = 0; // for block cipher input
byte* plain = 0; // for cipher decrypt comparison
byte* cipher = 0; // block output
byte* global_msg = 0; // for block cipher input
byte* global_plain = 0; // for cipher decrypt comparison
byte* global_cipher = 0; // block output
void taocrypt_test(void* args)
{
((func_args*)args)->return_code = -1; // error state
msg = NEW_TC byte[24];
plain = NEW_TC byte[24];
cipher = NEW_TC byte[24];
global_msg = NEW_TC byte[24];
global_plain = NEW_TC byte[24];
global_cipher = NEW_TC byte[24];
memcpy(msg, msgTmp, 24);
memcpy(global_msg, msgTmp, 24);
int ret = 0;
if ( (ret = sha_test()) )
@ -237,9 +237,9 @@ void taocrypt_test(void* args)
printf( "PKCS12 test passed!\n");
*/
tcArrayDelete(cipher);
tcArrayDelete(plain);
tcArrayDelete(msg);
tcArrayDelete(global_cipher);
tcArrayDelete(global_plain);
tcArrayDelete(global_msg);
((func_args*)args)->return_code = ret;
}
@ -606,11 +606,11 @@ int des_test()
const byte iv[] = { 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef };
enc.SetKey(key, sizeof(key));
enc.Process(cipher, msg, sz);
enc.Process(global_cipher, global_msg, sz);
dec.SetKey(key, sizeof(key));
dec.Process(plain, cipher, sz);
dec.Process(global_plain, global_cipher, sz);
if (memcmp(plain, msg, sz))
if (memcmp(global_plain, global_msg, sz))
return -50;
const byte verify1[] =
@ -620,7 +620,7 @@ int des_test()
0x89,0x3d,0x51,0xec,0x4b,0x56,0x3b,0x53
};
if (memcmp(cipher, verify1, sz))
if (memcmp(global_cipher, verify1, sz))
return -51;
// CBC mode
@ -628,11 +628,11 @@ int des_test()
DES_CBC_Decryption dec2;
enc2.SetKey(key, sizeof(key), iv);
enc2.Process(cipher, msg, sz);
enc2.Process(global_cipher, global_msg, sz);
dec2.SetKey(key, sizeof(key), iv);
dec2.Process(plain, cipher, sz);
dec2.Process(global_plain, global_cipher, sz);
if (memcmp(plain, msg, sz))
if (memcmp(global_plain, global_msg, sz))
return -52;
const byte verify2[] =
@ -642,7 +642,7 @@ int des_test()
0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
};
if (memcmp(cipher, verify2, sz))
if (memcmp(global_cipher, verify2, sz))
return -53;
// EDE3 CBC mode
@ -664,11 +664,11 @@ int des_test()
};
enc3.SetKey(key3, sizeof(key3), iv3);
enc3.Process(cipher, msg, sz);
enc3.Process(global_cipher, global_msg, sz);
dec3.SetKey(key3, sizeof(key3), iv3);
dec3.Process(plain, cipher, sz);
dec3.Process(global_plain, global_cipher, sz);
if (memcmp(plain, msg, sz))
if (memcmp(global_plain, global_msg, sz))
return -54;
const byte verify3[] =
@ -678,7 +678,7 @@ int des_test()
0x18,0xbc,0xbb,0x6d,0xd2,0xb1,0x16,0xda
};
if (memcmp(cipher, verify3, sz))
if (memcmp(global_cipher, verify3, sz))
return -55;
return 0;
@ -697,10 +697,10 @@ int aes_test()
enc.SetKey(key, bs, iv);
dec.SetKey(key, bs, iv);
enc.Process(cipher, msg, bs);
dec.Process(plain, cipher, bs);
enc.Process(global_cipher, global_msg, bs);
dec.Process(global_plain, global_cipher, bs);
if (memcmp(plain, msg, bs))
if (memcmp(global_plain, global_msg, bs))
return -60;
const byte verify[] =
@ -709,7 +709,7 @@ int aes_test()
0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
};
if (memcmp(cipher, verify, bs))
if (memcmp(global_cipher, verify, bs))
return -61;
AES_ECB_Encryption enc2;
@ -718,10 +718,10 @@ int aes_test()
enc2.SetKey(key, bs, iv);
dec2.SetKey(key, bs, iv);
enc2.Process(cipher, msg, bs);
dec2.Process(plain, cipher, bs);
enc2.Process(global_cipher, global_msg, bs);
dec2.Process(global_plain, global_cipher, bs);
if (memcmp(plain, msg, bs))
if (memcmp(global_plain, global_msg, bs))
return -62;
const byte verify2[] =
@ -730,7 +730,7 @@ int aes_test()
0xc8,0x8c,0x33,0x3b,0xb5,0x8f,0x85,0xd1
};
if (memcmp(cipher, verify2, bs))
if (memcmp(global_cipher, verify2, bs))
return -63;
return 0;
@ -749,10 +749,10 @@ int twofish_test()
enc.SetKey(key, bs, iv);
dec.SetKey(key, bs, iv);
enc.Process(cipher, msg, bs);
dec.Process(plain, cipher, bs);
enc.Process(global_cipher, global_msg, bs);
dec.Process(global_plain, global_cipher, bs);
if (memcmp(plain, msg, bs))
if (memcmp(global_plain, global_msg, bs))
return -60;
const byte verify[] =
@ -761,7 +761,7 @@ int twofish_test()
0x21,0x03,0x58,0x79,0x5F,0x02,0x27,0x2C
};
if (memcmp(cipher, verify, bs))
if (memcmp(global_cipher, verify, bs))
return -61;
Twofish_ECB_Encryption enc2;
@ -770,10 +770,10 @@ int twofish_test()
enc2.SetKey(key, bs, iv);
dec2.SetKey(key, bs, iv);
enc2.Process(cipher, msg, bs);
dec2.Process(plain, cipher, bs);
enc2.Process(global_cipher, global_msg, bs);
dec2.Process(global_plain, global_cipher, bs);
if (memcmp(plain, msg, bs))
if (memcmp(global_plain, global_msg, bs))
return -62;
const byte verify2[] =
@ -782,7 +782,7 @@ int twofish_test()
0xC4,0xCD,0x6B,0x91,0x14,0xC5,0x3A,0x09
};
if (memcmp(cipher, verify2, bs))
if (memcmp(global_cipher, verify2, bs))
return -63;
return 0;
@ -801,10 +801,10 @@ int blowfish_test()
enc.SetKey(key, 16, iv);
dec.SetKey(key, 16, iv);
enc.Process(cipher, msg, bs * 2);
dec.Process(plain, cipher, bs * 2);
enc.Process(global_cipher, global_msg, bs * 2);
dec.Process(global_plain, global_cipher, bs * 2);
if (memcmp(plain, msg, bs))
if (memcmp(global_plain, global_msg, bs))
return -60;
const byte verify[] =
@ -813,7 +813,7 @@ int blowfish_test()
0xBC,0xD9,0x08,0xC4,0x94,0x6C,0x89,0xA3
};
if (memcmp(cipher, verify, bs))
if (memcmp(global_cipher, verify, bs))
return -61;
Blowfish_ECB_Encryption enc2;
@ -822,10 +822,10 @@ int blowfish_test()
enc2.SetKey(key, 16, iv);
dec2.SetKey(key, 16, iv);
enc2.Process(cipher, msg, bs * 2);
dec2.Process(plain, cipher, bs * 2);
enc2.Process(global_cipher, global_msg, bs * 2);
dec2.Process(global_plain, global_cipher, bs * 2);
if (memcmp(plain, msg, bs))
if (memcmp(global_plain, global_msg, bs))
return -62;
const byte verify2[] =
@ -834,7 +834,7 @@ int blowfish_test()
0x8F,0xCE,0x39,0x32,0xDE,0xD7,0xBC,0x5B
};
if (memcmp(cipher, verify2, bs))
if (memcmp(global_cipher, verify2, bs))
return -63;
return 0;

View File

@ -86,8 +86,8 @@ int main(int argc, char** argv)
// input output compare
byte input[TaoCrypt::MD5::DIGEST_SIZE];
byte output[TaoCrypt::MD5::DIGEST_SIZE];
file_test("input", input);
file_test("output", output);
file_test((char*) "input", input);
file_test((char*) "output", output);
assert(memcmp(input, output, sizeof(input)) == 0);
printf("\nAll tests passed!\n");
@ -141,16 +141,17 @@ int test_openSSL_des()
/* test des encrypt/decrypt */
char data[] = "this is my data ";
int dataSz = strlen(data);
DES_key_schedule key[3];
DES_key_schedule local_key[3];
byte iv[8];
EVP_BytesToKey(EVP_des_ede3_cbc(), EVP_md5(), NULL, (byte*)data, dataSz, 1,
(byte*)key, iv);
(byte*)local_key, iv);
byte cipher[16];
DES_ede3_cbc_encrypt((byte*)data, cipher, dataSz, &key[0], &key[1],
&key[2], &iv, true);
DES_ede3_cbc_encrypt((byte*)data, cipher, dataSz,
&local_key[0], &local_key[1],
&local_key[2], &iv, true);
byte plain[16];
DES_ede3_cbc_encrypt(cipher, plain, 16, &key[0], &key[1], &key[2],
&iv, false);
DES_ede3_cbc_encrypt(cipher, plain, 16, &local_key[0], &local_key[1],
&local_key[2], &iv, false);
return 0;
}

View File

@ -68,7 +68,7 @@ int heap_write(HP_INFO *info, const byte *record)
err:
if (my_errno == HA_ERR_FOUND_DUPP_KEY)
DBUG_PRINT("info",("Duplicate key: %d", keydef - share->keydef));
DBUG_PRINT("info",("Duplicate key: %d", (int) (keydef - share->keydef)));
info->errkey= keydef - share->keydef;
/*
We don't need to delete non-inserted key from rb-tree. Also, if

View File

@ -90,7 +90,7 @@ typedef struct
{
uint beg;
uint end;
uint mblen;
uint mb_len;
} my_match_t;
enum my_lex_states

View File

@ -74,6 +74,7 @@ extern void _db_unlock_file(void);
#define DBUG_ASSERT(A) assert(A)
#define DBUG_EXECUTE_IF(keyword,a1) \
{if (_db_on_) {if (_db_strict_keyword_ (keyword)) { a1 }}}
#define IF_DBUG(A) A
#else /* No debugger */
#define DBUG_ENTER(a1)
@ -98,6 +99,7 @@ extern void _db_unlock_file(void);
#define DBUG_OUTPUT(A)
#define DBUG_ASSERT(A) {}
#define DBUG_LEAVE
#define IF_DBUG(A)
#endif
#ifdef __cplusplus
}

View File

@ -540,7 +540,7 @@ typedef unsigned short ushort;
duplicate declaration of __cxa_pure_virtual, solved by declaring it a
weak symbol.
*/
#ifdef USE_MYSYS_NEW
#if defined(USE_MYSYS_NEW) && ! defined(DONT_DECLARE_CXA_PURE_VIRTUAL)
C_MODE_START
int __cxa_pure_virtual () __attribute__ ((weak));
C_MODE_END
@ -846,6 +846,21 @@ typedef long long my_ptrdiff_t;
#define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size)
#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B))
/*
Custom version of standard offsetof() macro which can be used to get
offsets of members in class for non-POD types (according to the current
version of C++ standard offsetof() macro can't be used in such cases and
attempt to do so causes warnings to be emitted, OTOH in many cases it is
still OK to assume that all instances of the class has the same offsets
for the same members).
This is temporary solution which should be removed once File_parser class
and related routines are refactored.
*/
#define my_offsetof(TYPE, MEMBER) \
((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10))
#define NullS (char *) 0
/* Nowdays we do not support MessyDos */
#ifndef NEAR
@ -1078,7 +1093,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */
*/
#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
#endif
#define uint4korr(A) (*((unsigned long *) (A)))
#define uint4korr(A) (*((uint32 *) (A)))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16) +\

View File

@ -370,14 +370,14 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
we want to make sure that no such flags are set.
*/
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
#define my_sigset(A,B) do { struct sigaction s; sigset_t set; int rc; \
DBUG_ASSERT((A) != 0); \
sigemptyset(&set); \
s.sa_handler = (B); \
s.sa_mask = set; \
s.sa_flags = 0; \
rc= sigaction((A), &s, (struct sigaction *) NULL);\
DBUG_ASSERT(rc == 0); \
#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc; \
DBUG_ASSERT((A) != 0); \
sigemptyset(&l_set); \
l_s.sa_handler = (B); \
l_s.sa_mask = l_set; \
l_s.sa_flags = 0; \
l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\
DBUG_ASSERT(l_rc == 0); \
} while (0)
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
#define my_sigset(A,B) sigset((A),(B))

View File

@ -260,9 +260,10 @@ extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io,
NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks;
extern char wild_many,wild_one,wild_prefix;
extern const char *charsets_dir;
extern char *defaults_extra_file;
extern const char *defaults_group_suffix;
extern const char *defaults_file;
/* from default.c */
extern char *my_defaults_extra_file;
extern const char *my_defaults_group_suffix;
extern const char *my_defaults_file;
extern my_bool timed_mutexes;

View File

@ -30,7 +30,13 @@ extern uchar days_in_month[];
/*
Portable time_t replacement.
Should be signed and hold seconds for 1902-2038 range.
Should be signed and hold seconds for 1902 -- 2038-01-19 range
i.e at least a 32bit variable
Using the system built in time_t is not an option as
we rely on the above requirements in the time functions
For example QNX has an unsigned time_t type
*/
typedef long my_time_t;
@ -73,16 +79,16 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
uint flags, int *was_cut);
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
uint flags, int *was_cut);
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *time);
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *time);
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *time);
ulonglong TIME_to_ulonglong(const MYSQL_TIME *time);
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *);
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *);
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *);
ulonglong TIME_to_ulonglong(const MYSQL_TIME *);
my_bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
int *warning);
int check_time_range(struct st_mysql_time *time, int *warning);
int check_time_range(struct st_mysql_time *, int *warning);
long calc_daynr(uint year,uint month,uint day);
uint calc_days_in_year(uint year);

View File

@ -87,6 +87,7 @@ extern char *mysql_unix_port;
#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR || (t) == FIELD_TYPE_NEWDECIMAL)
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR)
#define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING)
typedef struct st_mysql_field {
@ -783,7 +784,7 @@ int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
unsigned long length);
int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg,
unsigned int column,
unsigned long offset);
int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);

View File

@ -388,8 +388,8 @@ ut_bit_set_nth(
ut_ad(TRUE == 1);
if (val) {
return((1 << n) | a);
return(((ulint) 1 << n) | a);
} else {
return(~(1 << n) & a);
return(~((ulint) 1 << n) & a);
}
}

View File

@ -170,5 +170,5 @@ ut_2_exp(
/* out: 2 to power n */
ulint n) /* in: number */
{
return(1 << n);
return((ulint) 1 << n);
}

View File

@ -1367,7 +1367,7 @@ mysql_stat(MYSQL *mysql)
{
DBUG_ENTER("mysql_stat");
if (simple_command(mysql,COM_STATISTICS,0,0,0))
return mysql->net.last_error;
DBUG_RETURN(mysql->net.last_error);
DBUG_RETURN((*mysql->methods->read_statistics)(mysql));
}
@ -1730,7 +1730,7 @@ static int stmt_read_row_no_result_set(MYSQL_STMT *stmt, unsigned char **row);
STMT_ATTR_UPDATE_MAX_LENGTH attribute is set.
*/
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data);
static my_bool setup_one_fetch_function(MYSQL_BIND *bind, MYSQL_FIELD *field);
static my_bool setup_one_fetch_function(MYSQL_BIND *, MYSQL_FIELD *field);
/* Auxilary function used to reset statement handle. */
@ -2174,7 +2174,7 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
MYSQL_FIELD *field= stmt->mysql->fields;
MYSQL_FIELD *field_end= field + stmt->field_count;
MYSQL_FIELD *stmt_field= stmt->fields;
MYSQL_BIND *bind= stmt->bind_result_done ? stmt->bind : 0;
MYSQL_BIND *my_bind= stmt->bind_result_done ? stmt->bind : 0;
DBUG_ASSERT(stmt->field_count == stmt->mysql->field_count);
@ -2185,10 +2185,10 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
stmt_field->type = field->type;
stmt_field->flags = field->flags;
stmt_field->decimals = field->decimals;
if (bind)
if (my_bind)
{
/* Ignore return value: it should be 0 if bind_result succeeded. */
(void) setup_one_fetch_function(bind++, stmt_field);
(void) setup_one_fetch_function(my_bind++, stmt_field);
}
}
}
@ -3014,7 +3014,7 @@ static my_bool int_is_null_false= 0;
mysql_stmt_bind_param()
stmt statement handle
The statement must be prepared with mysql_stmt_prepare().
bind Array of mysql_stmt_param_count() bind parameters.
my_bind Array of mysql_stmt_param_count() bind parameters.
This function doesn't check that size of this argument
is >= mysql_stmt_field_count(): it's user's responsibility.
@ -3089,65 +3089,66 @@ static my_bool int_is_null_false= 0;
to point to the buffer of given type. Finally, additional actions
may be taken for some types or use cases:
Binding integer types.
For integer types you might also need to set MYSQL_BIND::is_unsigned
member. Set it to TRUE when binding unsigned char, unsigned short,
unsigned int, unsigned long, unsigned long long.
Binding integer types.
For integer types you might also need to set MYSQL_BIND::is_unsigned
member. Set it to TRUE when binding unsigned char, unsigned short,
unsigned int, unsigned long, unsigned long long.
Binding floating point types.
For floating point types you just need to set
MYSQL_BIND::buffer_type and MYSQL_BIND::buffer. The rest of the
members should be zero-initialized.
Binding floating point types.
For floating point types you just need to set
MYSQL_BIND::buffer_type and MYSQL_BIND::buffer. The rest of the
members should be zero-initialized.
Binding NULLs.
You might have a column always NULL, never NULL, or sometimes NULL.
For an always NULL column set MYSQL_BIND::buffer_type to
MYSQL_TYPE_NULL. The rest of the members just need to be
zero-initialized. For never NULL columns set MYSQL_BIND::is_null to
0, or this has already been done if you zero-initialized the entire
structure. If you set MYSQL_TYPE::is_null to point to an
application buffer of type 'my_bool', then this buffer will be
checked on each execution: this way you can set the buffer to TRUE,
or any non-0 value for NULLs, and to FALSE or 0 for not NULL data.
Binding NULLs.
You might have a column always NULL, never NULL, or sometimes
NULL. For an always NULL column set MYSQL_BIND::buffer_type to
MYSQL_TYPE_NULL. The rest of the members just need to be
zero-initialized. For never NULL columns set
MYSQL_BIND::is_null to 0, or this has already been done if you
zero-initialized the entire structure. If you set
MYSQL_TYPE::is_null to point to an application buffer of type
'my_bool', then this buffer will be checked on each execution:
this way you can set the buffer to TRUE, or any non-0 value for
NULLs, and to FALSE or 0 for not NULL data.
Binding text strings and sequences of bytes.
For strings, in addition to MYSQL_BIND::buffer_type and
MYSQL_BIND::buffer you need to set MYSQL_BIND::length or
MYSQL_BIND::buffer_length.
If 'length' is set, 'buffer_length' is ignored. 'buffer_length'
member should be used when size of string doesn't change between
executions. If you want to vary buffer length for each value, set
'length' to point to an application buffer of type 'unsigned long'
and set this long to length of the string before each
mysql_stmt_execute().
Binding text strings and sequences of bytes.
For strings, in addition to MYSQL_BIND::buffer_type and
MYSQL_BIND::buffer you need to set MYSQL_BIND::length or
MYSQL_BIND::buffer_length. If 'length' is set, 'buffer_length'
is ignored. 'buffer_length' member should be used when size of
string doesn't change between executions. If you want to vary
buffer length for each value, set 'length' to point to an
application buffer of type 'unsigned long' and set this long to
length of the string before each mysql_stmt_execute().
Binding dates and times.
For binding dates and times prepared statements API provides clients
with MYSQL_TIME structure. A pointer to instance of this structure
should be assigned to MYSQL_BIND::buffer whenever MYSQL_TYPE_TIME,
MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME typecodes are used. When
typecode is MYSQL_TYPE_TIME, only members 'hour', 'minute', 'second'
and 'neg' (is time offset negative) are used. These members only
will be sent to the server.
MYSQL_TYPE_DATE implies use of 'year', 'month', 'day', 'neg'.
MYSQL_TYPE_DATETIME utilizes both parts of MYSQL_TIME structure.
You don't have to set MYSQL_TIME::time_type member: it's not used
when sending data to the server, typecode information is enough.
'second_part' member can hold microsecond precision of time value,
but now it's only supported on protocol level: you can't store
microsecond in a column, or use in temporal calculations. However,
if you send a time value with microsecond part for 'SELECT ?',
statement, you'll get it back unchanged from the server.
Binding dates and times.
For binding dates and times prepared statements API provides
clients with MYSQL_TIME structure. A pointer to instance of this
structure should be assigned to MYSQL_BIND::buffer whenever
MYSQL_TYPE_TIME, MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME typecodes
are used. When typecode is MYSQL_TYPE_TIME, only members
'hour', 'minute', 'second' and 'neg' (is time offset negative)
are used. These members only will be sent to the server.
MYSQL_TYPE_DATE implies use of 'year', 'month', 'day', 'neg'.
MYSQL_TYPE_DATETIME utilizes both parts of MYSQL_TIME structure.
You don't have to set MYSQL_TIME::time_type member: it's not
used when sending data to the server, typecode information is
enough. 'second_part' member can hold microsecond precision of
time value, but now it's only supported on protocol level: you
can't store microsecond in a column, or use in temporal
calculations. However, if you send a time value with microsecond
part for 'SELECT ?', statement, you'll get it back unchanged
from the server.
Data conversion.
If conversion from host language type to data representation,
corresponding to SQL type, is required it's done on the server.
Data truncation is possible when conversion is lossy. For example,
if you supply MYSQL_TYPE_DATETIME value out of valid SQL type
TIMESTAMP range, the same conversion will be applied as if this
value would have been sent as string in the old protocol.
TODO: document how the server will behave in case of truncation/data
loss.
Data conversion.
If conversion from host language type to data representation,
corresponding to SQL type, is required it's done on the server.
Data truncation is possible when conversion is lossy. For
example, if you supply MYSQL_TYPE_DATETIME value out of valid
SQL type TIMESTAMP range, the same conversion will be applied as
if this value would have been sent as string in the old
protocol. TODO: document how the server will behave in case of
truncation/data loss.
After variables were bound, you can repeatedly set/change their
values and mysql_stmt_execute() the statement.
@ -3175,7 +3176,7 @@ static my_bool int_is_null_false= 0;
1 error, can be retrieved with mysql_stmt_error.
*/
my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)
my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *my_bind)
{
uint count=0;
MYSQL_BIND *param, *end;
@ -3192,7 +3193,7 @@ my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)
}
/* Allocated on prepare */
memcpy((char*) stmt->params, (char*) bind,
memcpy((char*) stmt->params, (char*) my_bind,
sizeof(MYSQL_BIND) * stmt->param_count);
for (param= stmt->params, end= param+stmt->param_count;
@ -3355,8 +3356,7 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
}
param= stmt->params+param_number;
if (param->buffer_type < MYSQL_TYPE_TINY_BLOB ||
param->buffer_type > MYSQL_TYPE_STRING)
if (!IS_LONGDATA(param->buffer_type))
{
/* Long data handling should be used only for string/binary types */
strmov(stmt->sqlstate, unknown_sqlstate);
@ -3520,7 +3520,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
This function should support all target buffer types: the rest
of conversion functions can delegate conversion to it.
*/
switch(param->buffer_type) {
switch (param->buffer_type) {
case MYSQL_TYPE_NULL: /* do nothing */
break;
case MYSQL_TYPE_TINY:
@ -3862,32 +3862,32 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
static void fetch_datetime_with_conversion(MYSQL_BIND *param,
MYSQL_FIELD *field,
MYSQL_TIME *time)
MYSQL_TIME *my_time)
{
switch (param->buffer_type) {
case MYSQL_TYPE_NULL: /* do nothing */
break;
case MYSQL_TYPE_DATE:
*(MYSQL_TIME *)(param->buffer)= *time;
*param->error= time->time_type != MYSQL_TIMESTAMP_DATE;
*(MYSQL_TIME *)(param->buffer)= *my_time;
*param->error= my_time->time_type != MYSQL_TIMESTAMP_DATE;
break;
case MYSQL_TYPE_TIME:
*(MYSQL_TIME *)(param->buffer)= *time;
*param->error= time->time_type != MYSQL_TIMESTAMP_TIME;
*(MYSQL_TIME *)(param->buffer)= *my_time;
*param->error= my_time->time_type != MYSQL_TIMESTAMP_TIME;
break;
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
*(MYSQL_TIME *)(param->buffer)= *time;
*(MYSQL_TIME *)(param->buffer)= *my_time;
/* No error: time and date are compatible with datetime */
break;
case MYSQL_TYPE_YEAR:
shortstore(param->buffer, time->year);
shortstore(param->buffer, my_time->year);
*param->error= 1;
break;
case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_DOUBLE:
{
ulonglong value= TIME_to_ulonglong(time);
ulonglong value= TIME_to_ulonglong(my_time);
fetch_float_with_conversion(param, field,
ulonglong2double(value), DBL_DIG);
break;
@ -3898,7 +3898,7 @@ static void fetch_datetime_with_conversion(MYSQL_BIND *param,
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_LONGLONG:
{
longlong value= (longlong) TIME_to_ulonglong(time);
longlong value= (longlong) TIME_to_ulonglong(my_time);
fetch_long_with_conversion(param, field, value, TRUE);
break;
}
@ -3909,7 +3909,7 @@ static void fetch_datetime_with_conversion(MYSQL_BIND *param,
fetch_string_with_conversion:
*/
char buff[MAX_DATE_STRING_REP_LENGTH];
uint length= my_TIME_to_str(time, buff);
uint length= my_TIME_to_str(my_time, buff);
/* Resort to string conversion */
fetch_string_with_conversion(param, (char *)buff, length);
break;
@ -4275,6 +4275,8 @@ static my_bool is_binary_compatible(enum enum_field_types type1,
static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
{
DBUG_ENTER("setup_one_fetch_function");
/* Setup data copy functions for the different supported types */
switch (param->buffer_type) {
case MYSQL_TYPE_NULL: /* for dummy binds */
@ -4339,7 +4341,9 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
param->fetch_result= fetch_result_str;
break;
default:
return TRUE;
DBUG_PRINT("error", ("Unknown param->buffer_type: %u",
(uint) param->buffer_type));
DBUG_RETURN(TRUE);
}
if (! is_binary_compatible(param->buffer_type, field->type))
param->fetch_result= fetch_result_with_conversion;
@ -4408,9 +4412,10 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
param->skip_result= skip_result_string;
break;
default:
return TRUE;
DBUG_PRINT("error", ("Unknown field->type: %u", (uint) field->type));
DBUG_RETURN(TRUE);
}
return FALSE;
DBUG_RETURN(FALSE);
}
@ -4418,7 +4423,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
Setup the bind buffers for resultset processing
*/
my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *my_bind)
{
MYSQL_BIND *param, *end;
MYSQL_FIELD *field;
@ -4442,8 +4447,9 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
is called from mysql_stmt_store_result.
*/
if (stmt->bind != bind)
memcpy((char*) stmt->bind, (char*) bind, sizeof(MYSQL_BIND) * bind_count);
if (stmt->bind != my_bind)
memcpy((char*) stmt->bind, (char*) my_bind,
sizeof(MYSQL_BIND) * bind_count);
for (param= stmt->bind, end= param + bind_count, field= stmt->fields ;
param < end ;
@ -4490,7 +4496,7 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
{
MYSQL_BIND *bind, *end;
MYSQL_BIND *my_bind, *end;
MYSQL_FIELD *field;
uchar *null_ptr, bit;
int truncation_count= 0;
@ -4512,11 +4518,12 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
bit= 4; /* first 2 bits are reserved */
/* Copy complete row to application buffers */
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields ;
bind < end ;
bind++, field++)
for (my_bind= stmt->bind, end= my_bind + stmt->field_count,
field= stmt->fields ;
my_bind < end ;
my_bind++, field++)
{
*bind->error= 0;
*my_bind->error= 0;
if (*null_ptr & bit)
{
/*
@ -4526,15 +4533,15 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
mysql_stmt_fetch_column, and in this case nullness of column will be
lost. See mysql_stmt_fetch_column for details.
*/
bind->row_ptr= NULL;
*bind->is_null= 1;
my_bind->row_ptr= NULL;
*my_bind->is_null= 1;
}
else
{
*bind->is_null= 0;
bind->row_ptr= row;
(*bind->fetch_result)(bind, field, &row);
truncation_count+= *bind->error;
*my_bind->is_null= 0;
my_bind->row_ptr= row;
(*my_bind->fetch_result)(my_bind, field, &row);
truncation_count+= *my_bind->error;
}
if (!((bit<<=1) & 255))
{
@ -4591,7 +4598,7 @@ int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt)
SYNOPSIS
mysql_stmt_fetch_column()
stmt Prepared statement handler
bind Where data should be placed. Should be filled in as
my_bind Where data should be placed. Should be filled in as
when calling mysql_stmt_bind_result()
column Column to fetch (first column is 0)
ulong offset Offset in result data (to fetch blob in pieces)
@ -4601,7 +4608,7 @@ int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt)
1 error
*/
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *my_bind,
uint column, ulong offset)
{
MYSQL_BIND *param= stmt->bind+column;
@ -4618,26 +4625,26 @@ int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
DBUG_RETURN(1);
}
if (!bind->error)
bind->error= &bind->error_value;
*bind->error= 0;
if (!my_bind->error)
my_bind->error= &my_bind->error_value;
*my_bind->error= 0;
if (param->row_ptr)
{
MYSQL_FIELD *field= stmt->fields+column;
uchar *row= param->row_ptr;
bind->offset= offset;
if (bind->is_null)
*bind->is_null= 0;
if (bind->length) /* Set the length if non char/binary types */
*bind->length= *param->length;
my_bind->offset= offset;
if (my_bind->is_null)
*my_bind->is_null= 0;
if (my_bind->length) /* Set the length if non char/binary types */
*my_bind->length= *param->length;
else
bind->length= &param->length_value; /* Needed for fetch_result() */
fetch_result_with_conversion(bind, field, &row);
my_bind->length= &param->length_value; /* Needed for fetch_result() */
fetch_result_with_conversion(my_bind, field, &row);
}
else
{
if (bind->is_null)
*bind->is_null= 1;
if (my_bind->is_null)
*my_bind->is_null= 1;
}
DBUG_RETURN(0);
}
@ -4709,7 +4716,7 @@ err:
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
{
MYSQL_BIND *bind, *end;
MYSQL_BIND *my_bind, *end;
MYSQL_FIELD *field;
uchar *null_ptr, bit;
uchar *row= (uchar*) data->data;
@ -4722,12 +4729,12 @@ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data)
bit= 4; /* first 2 bits are reserved */
/* Go through all fields and calculate metadata */
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields ;
bind < end ;
bind++, field++)
for (my_bind= stmt->bind, end= my_bind + stmt->field_count, field= stmt->fields ;
my_bind < end ;
my_bind++, field++)
{
if (!(*null_ptr & bit))
(*bind->skip_result)(bind, field, &row);
(*my_bind->skip_result)(my_bind, field, &row);
DBUG_ASSERT(row <= row_end);
if (!((bit<<=1) & 255))
{
@ -4791,16 +4798,17 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
We must initalize the bind structure to be able to calculate
max_length
*/
MYSQL_BIND *bind, *end;
MYSQL_BIND *my_bind, *end;
MYSQL_FIELD *field;
bzero((char*) stmt->bind, sizeof(*stmt->bind)* stmt->field_count);
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields;
bind < end ;
bind++, field++)
for (my_bind= stmt->bind, end= my_bind + stmt->field_count,
field= stmt->fields;
my_bind < end ;
my_bind++, field++)
{
bind->buffer_type= MYSQL_TYPE_NULL;
bind->buffer_length=1;
my_bind->buffer_type= MYSQL_TYPE_NULL;
my_bind->buffer_length=1;
}
if (mysql_stmt_bind_result(stmt, stmt->bind))

View File

@ -1,5 +1,4 @@
LIBRARY LIBMYSQL
DESCRIPTION 'MySQL 5.0 Client Library'
VERSION 6.0
EXPORTS
_dig_vec_lower

View File

@ -1052,7 +1052,7 @@ void Protocol_simple::prepare_for_resend()
data->embedded_info->prev_ptr= &cur->next;
next_field=cur->data;
next_mysql_field= data->embedded_info->fields_list;
err:
DBUG_VOID_RETURN;
}

View File

@ -490,7 +490,7 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
FT_SEG_ITERATOR ftsi;
FTB_EXPR *ftbe;
float weight=ftbw->weight;
int yn=ftbw->flags, ythresh, mode=(ftsi_orig != 0);
int yn_flag= ftbw->flags, ythresh, mode=(ftsi_orig != 0);
my_off_t curdoc=ftbw->docid[mode];
for (ftbe=ftbw->up; ftbe; ftbe=ftbe->up)
@ -504,13 +504,13 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
}
if (ftbe->nos)
break;
if (yn & FTB_FLAG_YES)
if (yn_flag & FTB_FLAG_YES)
{
weight /= ftbe->ythresh;
ftbe->cur_weight += weight;
if ((int) ++ftbe->yesses == ythresh)
{
yn=ftbe->flags;
yn_flag=ftbe->flags;
weight=ftbe->cur_weight*ftbe->weight;
if (mode && ftbe->phrase)
{
@ -531,14 +531,14 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
break;
}
else
if (yn & FTB_FLAG_NO)
if (yn_flag & FTB_FLAG_NO)
{
/*
NOTE: special sort function of queue assures that all
(yn & FTB_FLAG_NO) != 0
(yn_flag & FTB_FLAG_NO) != 0
events for every particular subexpression will
"auto-magically" happen BEFORE all the
(yn & FTB_FLAG_YES) != 0 events. So no
(yn_flag & FTB_FLAG_YES) != 0 events. So no
already matched expression can become not-matched again.
*/
++ftbe->nos;
@ -551,8 +551,8 @@ static void _ftb_climb_the_tree(FTB *ftb, FTB_WORD *ftbw, FT_SEG_ITERATOR *ftsi_
ftbe->cur_weight += weight;
if ((int) ftbe->yesses < ythresh)
break;
if (!(yn & FTB_FLAG_WONLY))
yn= ((int) ftbe->yesses++ == ythresh) ? ftbe->flags : FTB_FLAG_WONLY ;
if (!(yn_flag & FTB_FLAG_WONLY))
yn_flag= ((int) ftbe->yesses++ == ythresh) ? ftbe->flags : FTB_FLAG_WONLY ;
weight*= ftbe->weight;
}
}

View File

@ -364,11 +364,11 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
else
{
uint j;
uint k;
share->keyinfo[i].seg=pos;
for (j=0; j < FT_SEGS; j++)
for (k=0; k < FT_SEGS; k++)
{
*pos=ft_keysegs[j];
*pos= ft_keysegs[k];
pos[0].language= pos[-1].language;
if (!(pos[0].charset= pos[-1].charset))
{

View File

@ -564,7 +564,7 @@ static void fill_quick_table(uint16 *table, uint bits, uint max_bits,
*/
value|= (max_bits - bits) << 8 | IS_CHAR;
for (end= table + (1 << bits); table < end; table++)
for (end= table + ((uint) 1 << bits); table < end; table++)
{
*table= (uint16) value;
}

View File

@ -470,9 +470,9 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
else
{
/* We have to compare k and vseg as if they were space extended */
uchar *end= k+ (cmplen - len);
for ( ; k < end && *k == ' '; k++) ;
if (k == end)
uchar *k_end= k+ (cmplen - len);
for ( ; k < k_end && *k == ' '; k++) ;
if (k == k_end)
goto cmp_rest; /* should never happen */
if (*k < (uchar) ' ')
{
@ -484,15 +484,15 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
}
else if (len > cmplen)
{
uchar *end;
uchar *vseg_end;
if ((nextflag & SEARCH_PREFIX) && key_len_left == 0)
goto fix_flag;
/* We have to compare k and vseg as if they were space extended */
for (end=vseg + (len-cmplen) ;
vseg < end && *vseg == (uchar) ' ';
for (vseg_end= vseg + (len-cmplen) ;
vseg < vseg_end && *vseg == (uchar) ' ';
vseg++, matched++) ;
DBUG_ASSERT(vseg < end);
DBUG_ASSERT(vseg < vseg_end);
if (*vseg > (uchar) ' ')
{

View File

@ -56,7 +56,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
if (_mi_search_next(info,info->s->keyinfo+def->key, info->lastkey,
MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER,
info->s->state.key_root[def->key]) ||
bcmp(info->lastkey, key_buff, MI_UNIQUE_HASH_LENGTH))
bcmp((char*) info->lastkey, (char*) key_buff, MI_UNIQUE_HASH_LENGTH))
{
info->page_changed=1; /* Can't optimize read next */
info->lastpos=lastpos;

View File

@ -720,6 +720,7 @@ get_one_option(int optid,
case 2:
method_conv= MI_STATS_METHOD_IGNORE_NULLS;
break;
default: assert(0); /* Impossible */
}
check_param.stats_method= method_conv;
break;

View File

@ -2689,8 +2689,9 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
}
case FIELD_VARCHAR:
{
uint pack_length= HA_VARCHAR_PACKLENGTH(count->field_length-1);
ulong col_length= (pack_length == 1 ? (uint) *(uchar*) start_pos :
uint var_pack_length= HA_VARCHAR_PACKLENGTH(count->field_length-1);
ulong col_length= (var_pack_length == 1 ?
(uint) *(uchar*) start_pos :
uint2korr(start_pos));
/* Empty varchar are encoded with a single 1 bit. */
if (!col_length)
@ -2700,7 +2701,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
}
else
{
byte *end=start_pos+pack_length+col_length;
byte *end= start_pos + var_pack_length + col_length;
DBUG_PRINT("fields", ("FIELD_VARCHAR not empty, bits: 1"));
write_bits(0,1);
/* Write the varchar length. */
@ -2708,7 +2709,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
col_length, count->length_bits));
write_bits(col_length,count->length_bits);
/* Encode the varchar bytes. */
for (start_pos+=pack_length ; start_pos < end ; start_pos++)
for (start_pos+= var_pack_length ; start_pos < end ; start_pos++)
{
DBUG_PRINT("fields",
("value: 0x%02x code: 0x%s bits: %2u bin: %s",

View File

@ -626,8 +626,6 @@ static int rtree_insert_level(MI_INFO *info, uint keynr, uchar *key,
if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
{
int res;
if ((old_root = _mi_new(info, keyinfo, DFLT_INIT_HITS)) == HA_OFFSET_ERROR)
return -1;
info->buff_used = 1;
@ -913,7 +911,6 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length)
for (i = 0; i < ReinsertList.n_pages; ++i)
{
uchar *page_buf;
uint nod_flag;
uchar *k;
uchar *last;

View File

@ -220,9 +220,9 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
if (my_b_inited(&tempfile_for_exceptions))
{
MI_INFO *index=info->sort_info->info;
MI_INFO *idx=info->sort_info->info;
uint keyno=info->key;
uint key_length, ref_length=index->s->rec_reflength;
uint key_length, ref_length=idx->s->rec_reflength;
if (!no_messages)
printf(" - Adding exceptions\n"); /* purecov: tested */
@ -235,7 +235,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
&& !my_b_read(&tempfile_for_exceptions,(byte*)sort_keys,
(uint) key_length))
{
if (_mi_ck_write(index,keyno,(uchar*) sort_keys,key_length-ref_length))
if (_mi_ck_write(idx,keyno,(uchar*) sort_keys,key_length-ref_length))
goto err;
}
}

View File

@ -66,7 +66,6 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(distdir)/lib
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
install-data-local:
@ -98,7 +97,6 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(DESTDIR)$(testdir)/lib
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib
uninstall-local:

View File

@ -0,0 +1,7 @@
# Allow anonymous users to connect
disable_warnings;
disable_query_log;
INSERT INTO mysql.user (host, user) VALUES ('localhost','');
FLUSH PRIVILEGES;
enable_query_log;
enable_warnings;

View File

@ -0,0 +1,5 @@
# Remove anonymous users added by add_anonymous_users.inc
disable_query_log;
DELETE FROM mysql.user where host='localhost' and user='';
FLUSH PRIVILEGES;
enable_query_log;

View File

@ -1,9 +1,22 @@
--exec $MYSQL test -e 'show processlist' | grep 'Binlog Dump' | cut -f1 > $MYSQLTEST_VARDIR/tmp/bl_dump_thread_id
--exec $MYSQL test -e "show processlist" > $MYSQLTEST_VARDIR/tmp/bl_dump_thread_id
--disable_warnings
drop table if exists t999;
--enable_warnings
create temporary table t999 (f int);
# Create a table to hold the process list
create temporary table t999(
id int,
user char(255),
host char(255),
db char(255),
Command char(255),
time int,
State char(255),
info char(255)
);
# Load processlist into table, headers will create seom warnings
--disable_warnings
--replace_result $MYSQLTEST_VARDIR "."
eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/bl_dump_thread_id" into table t999;
let $id = `select f from t999`;
--enable_warnings
let $id = `select Id from t999 where Command="Binlog Dump"`;
drop table t999;

View File

@ -165,14 +165,14 @@ insert IGNORE into t1 values ('Garbage');
drop table t1;
create table t1 (fl geometry);
create table t1 (fl geometry not null);
--error 1416
insert into t1 values (1);
--error 1416
insert into t1 values (1.11);
--error 1416
insert into t1 values ("qwerty");
--error 1416
--error 1048
insert into t1 values (pointfromtext('point(1,1)'));
drop table t1;

View File

@ -1,4 +0,0 @@
-- require r/have_openssl.require
disable_query_log;
show variables like "have_openssl";
enable_query_log;

View File

@ -0,0 +1,4 @@
-- require r/have_ssl.require
disable_query_log;
show variables like "have_ssl";
enable_query_log;

View File

@ -1152,19 +1152,19 @@ select '-- select .. where date/time column = .. --' as test_sequence ;
######## SELECT .. WHERE column(date/time/..)=value(CHAR(n)/LONGTEXT) ########
set @arg00= '1991-01-01 01:01:01' ;
select 'true' as found from t9
where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
c17= '1991-01-01 01:01:01' ;
select 'true' as found from t9
where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00
and c17= @arg00 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= '1991-01-01 01:01:01' and c14= '1991-01-01 01:01:01' and
where c1= 20 and c13= CAST('1991-01-01 01:01:01' AS DATE) and c14= '1991-01-01 01:01:01' and
c15= '1991-01-01 01:01:01' and c16= '1991-01-01 01:01:01' and
c17= '1991-01-01 01:01:01'" ;
execute stmt1 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;
@ -1177,7 +1177,7 @@ where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
c16= CAST('1991-01-01 01:01:01' as datetime) and
c17= CAST('1991-01-01 01:01:01' as datetime) ;
select 'true' as found from t9
where c1= 20 and c13= @arg00 and c14= @arg00 and c15= @arg00 and c16= @arg00
where c1= 20 and c13= CAST(@arg00 AS DATE) and c14= @arg00 and c15= @arg00 and c16= @arg00
and c17= @arg00 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
@ -1187,7 +1187,7 @@ where c1= 20 and c13= CAST('1991-01-01 01:01:01' as datetime) and
c17= CAST('1991-01-01 01:01:01' as datetime)" ;
execute stmt1 ;
prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c13= ? and c14= ? and c15= ? and c16= ? and c17= ?" ;
where c1= 20 and c13= CAST(? AS DATE) and c14= ? and c15= ? and c16= ? and c17= ?" ;
execute stmt1 using @arg00, @arg00, @arg00, @arg00, @arg00 ;

File diff suppressed because one or more lines are too long

View File

@ -1,559 +0,0 @@
use mysql;
set table_type=myisam;
CREATE TABLE db (
Host char(60) binary DEFAULT '' NOT NULL,
Db char(64) binary DEFAULT '' NOT NULL,
User char(16) binary DEFAULT '' NOT NULL,
Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
PRIMARY KEY Host (Host,Db,User),
KEY User (User)
) engine=MyISAM
CHARACTER SET utf8 COLLATE utf8_bin
comment='Database privileges';
INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');
CREATE TABLE host (
Host char(60) binary DEFAULT '' NOT NULL,
Db char(64) binary DEFAULT '' NOT NULL,
Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
PRIMARY KEY Host (Host,Db)
) engine=MyISAM
CHARACTER SET utf8 COLLATE utf8_bin
comment='Host privileges; Merged with database privileges';
CREATE TABLE user (
Host char(60) binary DEFAULT '' NOT NULL,
User char(16) binary DEFAULT '' NOT NULL,
Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL,
Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
ssl_cipher BLOB NOT NULL,
x509_issuer BLOB NOT NULL,
x509_subject BLOB NOT NULL,
max_questions int(11) unsigned DEFAULT 0 NOT NULL,
max_updates int(11) unsigned DEFAULT 0 NOT NULL,
max_connections int(11) unsigned DEFAULT 0 NOT NULL,
max_user_connections int(11) unsigned DEFAULT 0 NOT NULL,
PRIMARY KEY Host (Host,User)
) engine=MyISAM
CHARACTER SET utf8 COLLATE utf8_bin
comment='Users and global privileges';
INSERT INTO user VALUES ('localhost' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
INSERT INTO user VALUES ('@HOSTNAME@%' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
REPLACE INTO user VALUES ('127.0.0.1' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
INSERT INTO user (host,user) VALUES ('localhost','');
INSERT INTO user (host,user) VALUES ('@HOSTNAME@%','');
CREATE TABLE func (
name char(64) binary DEFAULT '' NOT NULL,
ret tinyint(1) DEFAULT '0' NOT NULL,
dl char(128) DEFAULT '' NOT NULL,
type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (name)
) engine=MyISAM
CHARACTER SET utf8 COLLATE utf8_bin
comment='User defined functions';
CREATE TABLE tables_priv (
Host char(60) binary DEFAULT '' NOT NULL,
Db char(64) binary DEFAULT '' NOT NULL,
User char(16) binary DEFAULT '' NOT NULL,
Table_name char(64) binary DEFAULT '' NOT NULL,
Grantor char(77) DEFAULT '' NOT NULL,
Timestamp timestamp(14),
Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
PRIMARY KEY (Host,Db,User,Table_name),KEY Grantor (Grantor)
) engine=MyISAM
CHARACTER SET utf8 COLLATE utf8_bin
comment='Table privileges';
CREATE TABLE columns_priv (
Host char(60) binary DEFAULT '' NOT NULL,
Db char(64) binary DEFAULT '' NOT NULL,
User char(16) binary DEFAULT '' NOT NULL,
Table_name char(64) binary DEFAULT '' NOT NULL,
Column_name char(64) binary DEFAULT '' NOT NULL,
Timestamp timestamp(14),
Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
PRIMARY KEY (Host,Db,User,Table_name,Column_name)
) engine=MyISAM
CHARACTER SET utf8 COLLATE utf8_bin
comment='Column privileges';
CREATE TABLE help_topic (
help_topic_id int unsigned not null,
name char(64) not null,
help_category_id smallint unsigned not null,
description text not null,
example text not null,
url char(128) not null,
primary key (help_topic_id),
unique index (name)
) engine=MyISAM
CHARACTER SET utf8
comment='help topics';
CREATE TABLE help_category (
help_category_id smallint unsigned not null,
name char(64) not null,
parent_category_id smallint unsigned null,
url char(128) not null,
primary key (help_category_id),unique index (name)
) engine=MyISAM
CHARACTER SET utf8
comment='help categories';
CREATE TABLE help_keyword (
help_keyword_id int unsigned not null,
name char(64) not null,
primary key (help_keyword_id),unique index (name)
) engine=MyISAM
CHARACTER SET utf8
comment='help keywords';
CREATE TABLE help_relation (
help_topic_id int unsigned not null references help_topic,
help_keyword_id int unsigned not null references help_keyword,
primary key (help_keyword_id, help_topic_id)
) engine=MyISAM
CHARACTER SET utf8
comment='keyword-topic relation';
CREATE TABLE time_zone_name (
Name char(64) NOT NULL,
Time_zone_id int unsigned NOT NULL,
PRIMARY KEY Name (Name)
) engine=MyISAM
CHARACTER SET utf8
comment='Time zone names';
INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES
('MET', 1), ('UTC', 2), ('Universal', 2),
('Europe/Moscow',3), ('leap/Europe/Moscow',4),
('Japan', 5);
CREATE TABLE time_zone (
Time_zone_id int unsigned NOT NULL auto_increment,
Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
PRIMARY KEY TzId (Time_zone_id)
) engine=MyISAM
CHARACTER SET utf8
comment='Time zones';
INSERT INTO time_zone (Time_zone_id, Use_leap_seconds)
VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N');
CREATE TABLE time_zone_transition (
Time_zone_id int unsigned NOT NULL,
Transition_time bigint signed NOT NULL,
Transition_type_id int unsigned NOT NULL,
PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)
) engine=MyISAM
CHARACTER SET utf8
comment='Time zone transitions';
INSERT INTO time_zone_transition
(Time_zone_id, Transition_time, Transition_type_id)
VALUES
(1, -1693706400, 0) ,(1, -1680483600, 1)
,(1, -1663455600, 2) ,(1, -1650150000, 3)
,(1, -1632006000, 2) ,(1, -1618700400, 3)
,(1, -938905200, 2) ,(1, -857257200, 3)
,(1, -844556400, 2) ,(1, -828226800, 3)
,(1, -812502000, 2) ,(1, -796777200, 3)
,(1, 228877200, 2) ,(1, 243997200, 3)
,(1, 260326800, 2) ,(1, 276051600, 3)
,(1, 291776400, 2) ,(1, 307501200, 3)
,(1, 323830800, 2) ,(1, 338950800, 3)
,(1, 354675600, 2) ,(1, 370400400, 3)
,(1, 386125200, 2) ,(1, 401850000, 3)
,(1, 417574800, 2) ,(1, 433299600, 3)
,(1, 449024400, 2) ,(1, 465354000, 3)
,(1, 481078800, 2) ,(1, 496803600, 3)
,(1, 512528400, 2) ,(1, 528253200, 3)
,(1, 543978000, 2) ,(1, 559702800, 3)
,(1, 575427600, 2) ,(1, 591152400, 3)
,(1, 606877200, 2) ,(1, 622602000, 3)
,(1, 638326800, 2) ,(1, 654656400, 3)
,(1, 670381200, 2) ,(1, 686106000, 3)
,(1, 701830800, 2) ,(1, 717555600, 3)
,(1, 733280400, 2) ,(1, 749005200, 3)
,(1, 764730000, 2) ,(1, 780454800, 3)
,(1, 796179600, 2) ,(1, 811904400, 3)
,(1, 828234000, 2) ,(1, 846378000, 3)
,(1, 859683600, 2) ,(1, 877827600, 3)
,(1, 891133200, 2) ,(1, 909277200, 3)
,(1, 922582800, 2) ,(1, 941331600, 3)
,(1, 954032400, 2) ,(1, 972781200, 3)
,(1, 985482000, 2) ,(1, 1004230800, 3)
,(1, 1017536400, 2) ,(1, 1035680400, 3)
,(1, 1048986000, 2) ,(1, 1067130000, 3)
,(1, 1080435600, 2) ,(1, 1099184400, 3)
,(1, 1111885200, 2) ,(1, 1130634000, 3)
,(1, 1143334800, 2) ,(1, 1162083600, 3)
,(1, 1174784400, 2) ,(1, 1193533200, 3)
,(1, 1206838800, 2) ,(1, 1224982800, 3)
,(1, 1238288400, 2) ,(1, 1256432400, 3)
,(1, 1269738000, 2) ,(1, 1288486800, 3)
,(1, 1301187600, 2) ,(1, 1319936400, 3)
,(1, 1332637200, 2) ,(1, 1351386000, 3)
,(1, 1364691600, 2) ,(1, 1382835600, 3)
,(1, 1396141200, 2) ,(1, 1414285200, 3)
,(1, 1427590800, 2) ,(1, 1445734800, 3)
,(1, 1459040400, 2) ,(1, 1477789200, 3)
,(1, 1490490000, 2) ,(1, 1509238800, 3)
,(1, 1521939600, 2) ,(1, 1540688400, 3)
,(1, 1553994000, 2) ,(1, 1572138000, 3)
,(1, 1585443600, 2) ,(1, 1603587600, 3)
,(1, 1616893200, 2) ,(1, 1635642000, 3)
,(1, 1648342800, 2) ,(1, 1667091600, 3)
,(1, 1679792400, 2) ,(1, 1698541200, 3)
,(1, 1711846800, 2) ,(1, 1729990800, 3)
,(1, 1743296400, 2) ,(1, 1761440400, 3)
,(1, 1774746000, 2) ,(1, 1792890000, 3)
,(1, 1806195600, 2) ,(1, 1824944400, 3)
,(1, 1837645200, 2) ,(1, 1856394000, 3)
,(1, 1869094800, 2) ,(1, 1887843600, 3)
,(1, 1901149200, 2) ,(1, 1919293200, 3)
,(1, 1932598800, 2) ,(1, 1950742800, 3)
,(1, 1964048400, 2) ,(1, 1982797200, 3)
,(1, 1995498000, 2) ,(1, 2014246800, 3)
,(1, 2026947600, 2) ,(1, 2045696400, 3)
,(1, 2058397200, 2) ,(1, 2077146000, 3)
,(1, 2090451600, 2) ,(1, 2108595600, 3)
,(1, 2121901200, 2) ,(1, 2140045200, 3)
,(3, -1688265000, 2) ,(3, -1656819048, 1)
,(3, -1641353448, 2) ,(3, -1627965048, 3)
,(3, -1618716648, 1) ,(3, -1596429048, 3)
,(3, -1593829848, 5) ,(3, -1589860800, 4)
,(3, -1542427200, 5) ,(3, -1539493200, 6)
,(3, -1525323600, 5) ,(3, -1522728000, 4)
,(3, -1491188400, 7) ,(3, -1247536800, 4)
,(3, 354920400, 5) ,(3, 370728000, 4)
,(3, 386456400, 5) ,(3, 402264000, 4)
,(3, 417992400, 5) ,(3, 433800000, 4)
,(3, 449614800, 5) ,(3, 465346800, 8)
,(3, 481071600, 9) ,(3, 496796400, 8)
,(3, 512521200, 9) ,(3, 528246000, 8)
,(3, 543970800, 9) ,(3, 559695600, 8)
,(3, 575420400, 9) ,(3, 591145200, 8)
,(3, 606870000, 9) ,(3, 622594800, 8)
,(3, 638319600, 9) ,(3, 654649200, 8)
,(3, 670374000, 10) ,(3, 686102400, 11)
,(3, 695779200, 8) ,(3, 701812800, 5)
,(3, 717534000, 4) ,(3, 733273200, 9)
,(3, 748998000, 8) ,(3, 764722800, 9)
,(3, 780447600, 8) ,(3, 796172400, 9)
,(3, 811897200, 8) ,(3, 828226800, 9)
,(3, 846370800, 8) ,(3, 859676400, 9)
,(3, 877820400, 8) ,(3, 891126000, 9)
,(3, 909270000, 8) ,(3, 922575600, 9)
,(3, 941324400, 8) ,(3, 954025200, 9)
,(3, 972774000, 8) ,(3, 985474800, 9)
,(3, 1004223600, 8) ,(3, 1017529200, 9)
,(3, 1035673200, 8) ,(3, 1048978800, 9)
,(3, 1067122800, 8) ,(3, 1080428400, 9)
,(3, 1099177200, 8) ,(3, 1111878000, 9)
,(3, 1130626800, 8) ,(3, 1143327600, 9)
,(3, 1162076400, 8) ,(3, 1174777200, 9)
,(3, 1193526000, 8) ,(3, 1206831600, 9)
,(3, 1224975600, 8) ,(3, 1238281200, 9)
,(3, 1256425200, 8) ,(3, 1269730800, 9)
,(3, 1288479600, 8) ,(3, 1301180400, 9)
,(3, 1319929200, 8) ,(3, 1332630000, 9)
,(3, 1351378800, 8) ,(3, 1364684400, 9)
,(3, 1382828400, 8) ,(3, 1396134000, 9)
,(3, 1414278000, 8) ,(3, 1427583600, 9)
,(3, 1445727600, 8) ,(3, 1459033200, 9)
,(3, 1477782000, 8) ,(3, 1490482800, 9)
,(3, 1509231600, 8) ,(3, 1521932400, 9)
,(3, 1540681200, 8) ,(3, 1553986800, 9)
,(3, 1572130800, 8) ,(3, 1585436400, 9)
,(3, 1603580400, 8) ,(3, 1616886000, 9)
,(3, 1635634800, 8) ,(3, 1648335600, 9)
,(3, 1667084400, 8) ,(3, 1679785200, 9)
,(3, 1698534000, 8) ,(3, 1711839600, 9)
,(3, 1729983600, 8) ,(3, 1743289200, 9)
,(3, 1761433200, 8) ,(3, 1774738800, 9)
,(3, 1792882800, 8) ,(3, 1806188400, 9)
,(3, 1824937200, 8) ,(3, 1837638000, 9)
,(3, 1856386800, 8) ,(3, 1869087600, 9)
,(3, 1887836400, 8) ,(3, 1901142000, 9)
,(3, 1919286000, 8) ,(3, 1932591600, 9)
,(3, 1950735600, 8) ,(3, 1964041200, 9)
,(3, 1982790000, 8) ,(3, 1995490800, 9)
,(3, 2014239600, 8) ,(3, 2026940400, 9)
,(3, 2045689200, 8) ,(3, 2058390000, 9)
,(3, 2077138800, 8) ,(3, 2090444400, 9)
,(3, 2108588400, 8) ,(3, 2121894000, 9)
,(3, 2140038000, 8)
,(4, -1688265000, 2) ,(4, -1656819048, 1)
,(4, -1641353448, 2) ,(4, -1627965048, 3)
,(4, -1618716648, 1) ,(4, -1596429048, 3)
,(4, -1593829848, 5) ,(4, -1589860800, 4)
,(4, -1542427200, 5) ,(4, -1539493200, 6)
,(4, -1525323600, 5) ,(4, -1522728000, 4)
,(4, -1491188400, 7) ,(4, -1247536800, 4)
,(4, 354920409, 5) ,(4, 370728010, 4)
,(4, 386456410, 5) ,(4, 402264011, 4)
,(4, 417992411, 5) ,(4, 433800012, 4)
,(4, 449614812, 5) ,(4, 465346812, 8)
,(4, 481071612, 9) ,(4, 496796413, 8)
,(4, 512521213, 9) ,(4, 528246013, 8)
,(4, 543970813, 9) ,(4, 559695613, 8)
,(4, 575420414, 9) ,(4, 591145214, 8)
,(4, 606870014, 9) ,(4, 622594814, 8)
,(4, 638319615, 9) ,(4, 654649215, 8)
,(4, 670374016, 10) ,(4, 686102416, 11)
,(4, 695779216, 8) ,(4, 701812816, 5)
,(4, 717534017, 4) ,(4, 733273217, 9)
,(4, 748998018, 8) ,(4, 764722818, 9)
,(4, 780447619, 8) ,(4, 796172419, 9)
,(4, 811897219, 8) ,(4, 828226820, 9)
,(4, 846370820, 8) ,(4, 859676420, 9)
,(4, 877820421, 8) ,(4, 891126021, 9)
,(4, 909270021, 8) ,(4, 922575622, 9)
,(4, 941324422, 8) ,(4, 954025222, 9)
,(4, 972774022, 8) ,(4, 985474822, 9)
,(4, 1004223622, 8) ,(4, 1017529222, 9)
,(4, 1035673222, 8) ,(4, 1048978822, 9)
,(4, 1067122822, 8) ,(4, 1080428422, 9)
,(4, 1099177222, 8) ,(4, 1111878022, 9)
,(4, 1130626822, 8) ,(4, 1143327622, 9)
,(4, 1162076422, 8) ,(4, 1174777222, 9)
,(4, 1193526022, 8) ,(4, 1206831622, 9)
,(4, 1224975622, 8) ,(4, 1238281222, 9)
,(4, 1256425222, 8) ,(4, 1269730822, 9)
,(4, 1288479622, 8) ,(4, 1301180422, 9)
,(4, 1319929222, 8) ,(4, 1332630022, 9)
,(4, 1351378822, 8) ,(4, 1364684422, 9)
,(4, 1382828422, 8) ,(4, 1396134022, 9)
,(4, 1414278022, 8) ,(4, 1427583622, 9)
,(4, 1445727622, 8) ,(4, 1459033222, 9)
,(4, 1477782022, 8) ,(4, 1490482822, 9)
,(4, 1509231622, 8) ,(4, 1521932422, 9)
,(4, 1540681222, 8) ,(4, 1553986822, 9)
,(4, 1572130822, 8) ,(4, 1585436422, 9)
,(4, 1603580422, 8) ,(4, 1616886022, 9)
,(4, 1635634822, 8) ,(4, 1648335622, 9)
,(4, 1667084422, 8) ,(4, 1679785222, 9)
,(4, 1698534022, 8) ,(4, 1711839622, 9)
,(4, 1729983622, 8) ,(4, 1743289222, 9)
,(4, 1761433222, 8) ,(4, 1774738822, 9)
,(4, 1792882822, 8) ,(4, 1806188422, 9)
,(4, 1824937222, 8) ,(4, 1837638022, 9)
,(4, 1856386822, 8) ,(4, 1869087622, 9)
,(4, 1887836422, 8) ,(4, 1901142022, 9)
,(4, 1919286022, 8) ,(4, 1932591622, 9)
,(4, 1950735622, 8) ,(4, 1964041222, 9)
,(4, 1982790022, 8) ,(4, 1995490822, 9)
,(4, 2014239622, 8) ,(4, 2026940422, 9)
,(4, 2045689222, 8) ,(4, 2058390022, 9)
,(4, 2077138822, 8) ,(4, 2090444422, 9)
,(4, 2108588422, 8) ,(4, 2121894022, 9)
,(4, 2140038022, 8)
,(5, -1009875600, 1);
CREATE TABLE time_zone_transition_type (
Time_zone_id int unsigned NOT NULL,
Transition_type_id int unsigned NOT NULL,
Offset int signed DEFAULT 0 NOT NULL,
Is_DST tinyint unsigned DEFAULT 0 NOT NULL,
Abbreviation char(8) DEFAULT '' NOT NULL,
PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)
) engine=MyISAM
CHARACTER SET utf8
comment='Time zone transition types';
INSERT INTO time_zone_transition_type (
Time_zone_id,Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET')
,(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET')
,(2, 0, 0, 0, 'UTC')
,(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST')
,(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST')
,(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD')
,(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET')
,(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD')
,(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET')
,(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST')
,(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST')
,(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD')
,(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET')
,(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD')
,(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET')
,(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST');
CREATE TABLE time_zone_leap_second (
Transition_time bigint signed NOT NULL,
Correction int signed NOT NULL,
PRIMARY KEY TranTime (Transition_time)
) engine=MyISAM
CHARACTER SET utf8
comment='Leap seconds information for time zones';
INSERT INTO time_zone_leap_second (
Transition_time, Correction) VALUES
(78796800, 1) ,(94694401, 2) ,(126230402, 3)
,(157766403, 4) ,(189302404, 5) ,(220924805, 6)
,(252460806, 7) ,(283996807, 8) ,(315532808, 9)
,(362793609, 10) ,(394329610, 11) ,(425865611, 12)
,(489024012, 13) ,(567993613, 14) ,(631152014, 15)
,(662688015, 16) ,(709948816, 17) ,(741484817, 18)
,(773020818, 19) ,(820454419, 20) ,(867715220, 21)
,(915148821, 22);
CREATE TABLE procs_priv (
Host char(60) binary DEFAULT '' NOT NULL,
Db char(64) binary DEFAULT '' NOT NULL,
User char(16) binary DEFAULT '' NOT NULL,
Routine_name char(64) binary DEFAULT '' NOT NULL,
Routine_type enum('FUNCTION','PROCEDURE') NOT NULL,
Grantor char(77) DEFAULT '' NOT NULL,
Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
Timestamp timestamp(14),
PRIMARY KEY (Host,Db,User,Routine_name,Routine_type),
KEY Grantor (Grantor)
) engine=MyISAM
CHARACTER SET utf8 COLLATE utf8_bin
comment='Procedure privileges';
CREATE TABLE proc (
db char(64) collate utf8_bin DEFAULT '' NOT NULL,
name char(64) DEFAULT '' NOT NULL,
type enum('FUNCTION','PROCEDURE') NOT NULL,
specific_name char(64) DEFAULT '' NOT NULL,
language enum('SQL') DEFAULT 'SQL' NOT NULL,
sql_data_access enum('CONTAINS_SQL',
'NO_SQL',
'READS_SQL_DATA',
'MODIFIES_SQL_DATA'
) DEFAULT 'CONTAINS_SQL' NOT NULL,
is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL,
security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL,
param_list blob DEFAULT '' NOT NULL,
returns char(64) DEFAULT '' NOT NULL,
body longblob DEFAULT '' NOT NULL,
definer char(77) collate utf8_bin DEFAULT '' NOT NULL,
created timestamp,
modified timestamp,
sql_mode set(
'REAL_AS_FLOAT',
'PIPES_AS_CONCAT',
'ANSI_QUOTES',
'IGNORE_SPACE',
'NOT_USED',
'ONLY_FULL_GROUP_BY',
'NO_UNSIGNED_SUBTRACTION',
'NO_DIR_IN_CREATE',
'POSTGRESQL',
'ORACLE',
'MSSQL',
'DB2',
'MAXDB',
'NO_KEY_OPTIONS',
'NO_TABLE_OPTIONS',
'NO_FIELD_OPTIONS',
'MYSQL323',
'MYSQL40',
'ANSI',
'NO_AUTO_VALUE_ON_ZERO',
'NO_BACKSLASH_ESCAPES',
'STRICT_TRANS_TABLES',
'STRICT_ALL_TABLES',
'NO_ZERO_IN_DATE',
'NO_ZERO_DATE',
'INVALID_DATES',
'ERROR_FOR_DIVISION_BY_ZERO',
'TRADITIONAL',
'NO_AUTO_CREATE_USER',
'HIGH_NOT_PRECEDENCE'
) DEFAULT '' NOT NULL,
comment char(64) collate utf8_bin DEFAULT '' NOT NULL,
PRIMARY KEY (db,name,type)
) character set utf8 comment='Stored Procedures';

View File

@ -22,6 +22,7 @@ use strict;
sub mtr_full_hostname ();
sub mtr_short_hostname ();
sub mtr_native_path($);
sub mtr_init_args ($);
sub mtr_add_arg ($$@);
sub mtr_path_exists(@);
@ -63,6 +64,22 @@ sub mtr_short_hostname () {
return $hostname;
}
# Convert path to OS native format
sub mtr_native_path($)
{
my $path= shift;
# MySQL version before 5.0 still use cygwin, no need
# to convert path
return $path
if ($::mysql_version_id < 50000);
$path=~ s/\//\\/g
if ($::glob_win32);
return $path;
}
# FIXME move to own lib
sub mtr_init_args ($) {

View File

@ -22,7 +22,7 @@ use Socket;
use Errno;
use strict;
use POSIX 'WNOHANG';
use POSIX qw(WNOHANG SIGHUP);
sub mtr_run ($$$$$$;$);
sub mtr_spawn ($$$$$$;$);
@ -139,19 +139,18 @@ sub spawn_impl ($$$$$$$$) {
{
if ( $! == $!{EAGAIN} ) # See "perldoc Errno"
{
mtr_debug("Got EAGAIN from fork(), sleep 1 second and redo");
mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo");
sleep(1);
redo FORK;
}
else
{
mtr_error("$path ($pid) can't be forked");
}
mtr_error("$path ($pid) can't be forked, error: $!");
}
if ( $pid )
{
spawn_parent_impl($pid,$mode,$path);
return spawn_parent_impl($pid,$mode,$path);
}
else
{
@ -216,8 +215,11 @@ sub spawn_impl ($$$$$$$$) {
{
mtr_child_error("failed to execute \"$path\": $!");
}
mtr_error("Should never come here 1!");
}
mtr_error("Should never come here 2!");
}
mtr_error("Should never come here 3!");
}
@ -230,12 +232,21 @@ sub spawn_parent_impl {
{
if ( $mode eq 'run' )
{
# Simple run of command, we wait for it to return
# Simple run of command, wait blocking for it to return
my $ret_pid= waitpid($pid,0);
if ( $ret_pid != $pid )
{
mtr_error("waitpid($pid, 0) returned $ret_pid " .
"when waiting for '$path'");
# The "simple" waitpid has failed, print debug info
# and try to handle the error
mtr_warning("waitpid($pid, 0) returned $ret_pid " .
"when waiting for '$path', error: '$!'");
if ( $ret_pid == -1 )
{
# waitpid returned -1, that would indicate the process
# no longer exist and waitpid couldn't wait for it.
return 1;
}
mtr_error("Error handling failed");
}
return mtr_process_exit_status($?);
@ -1109,12 +1120,6 @@ sub mtr_kill_processes ($) {
#
##############################################################################
# FIXME something is wrong, we sometimes terminate with "Hangup" written
# to tty, and no STDERR output telling us why.
# FIXME for some reason, setting HUP to 'IGNORE' will cause exit() to
# write out "Hangup", and maybe loose some output. We insert a sleep...
sub mtr_exit ($) {
my $code= shift;
mtr_timer_stop_all($::glob_timers);
@ -1126,7 +1131,7 @@ sub mtr_exit ($) {
# set ourselves as the group leader at startup (with
# POSIX::setpgrp(0,0)), but then care must be needed to always do
# proper child process cleanup.
kill('HUP', -$$) if !$::glob_win32_perl and $$ == getpgrp();
POSIX::kill(SIGHUP, -$$) if !$::glob_win32_perl and $$ == getpgrp();
exit($code);
}

View File

@ -236,8 +236,10 @@ sub mtr_report_stats ($) {
"the documentation at\n",
"http://www.mysql.com/doc/en/MySQL_test_suite.html\n";
}
print
"The servers were restarted $tot_restarts times\n";
if (!$::opt_extern)
{
print "The servers where restarted $tot_restarts times\n";
}
if ( $::opt_timer )
{

View File

@ -299,6 +299,8 @@ our $path_ndb_examples_dir;
our $exe_ndb_example;
our $path_ndb_testrun_log;
our $path_sql_dir;
our @data_dir_lst;
our $used_binlog_format;
@ -356,6 +358,7 @@ sub stop_all_servers ();
sub run_mysqltest ($);
sub usage ($);
######################################################################
#
# Main program
@ -699,7 +702,9 @@ sub command_line_setup () {
"$glob_basedir/client",
"$glob_basedir/bin");
$exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
if (!$opt_extern)
{
$exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
"$glob_basedir/sql/mysqld",
"$path_client_bindir/mysqld-max-nt",
"$path_client_bindir/mysqld-max",
@ -711,8 +716,16 @@ sub command_line_setup () {
"$glob_basedir/bin/mysqld",
"$glob_basedir/sbin/mysqld");
# Use the mysqld found above to find out what features are available
collect_mysqld_features();
# Use the mysqld found above to find out what features are available
collect_mysqld_features();
}
else
{
$mysqld_variables{'port'}= 3306;
$mysqld_variables{'master-port'}= 3306;
$opt_skip_ndbcluster= 1;
$opt_skip_im= 1;
}
if ( $opt_comment )
{
@ -749,7 +762,7 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# NOTE if the default binlog format is changed, this has to be changed
$used_binlog_format= "stmt";
if ( $mysql_version_id >= 50100 )
if (!$opt_extern && $mysql_version_id >= 50100 )
{
$used_binlog_format= "mixed"; # Default value for binlog format
@ -835,19 +848,20 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Check im suport
# --------------------------------------------------------------------------
if ( $mysql_version_id < 50000 )
if (!$opt_extern)
{
# Instance manager is not supported until 5.0
$opt_skip_im= 1;
if ( $mysql_version_id < 50000 ) {
# Instance manager is not supported until 5.0
$opt_skip_im= 1;
}
if ( $glob_win32 ) {
mtr_report("Disable Instance manager - not supported on Windows");
$opt_skip_im= 1;
}
}
if ( $glob_win32 )
{
mtr_report("Disable Instance manager - not supported on Windows");
$opt_skip_im= 1;
}
# --------------------------------------------------------------------------
# Record flag
# --------------------------------------------------------------------------
@ -1211,7 +1225,7 @@ sub command_line_setup () {
$opt_skip_rpl= 1;
# Setup master->[0] with the settings for the extern server
$master->[0]->{'path_sock'}= $opt_socket if $opt_socket;
$master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock";
mtr_report("Using extern server at '$master->[0]->{path_sock}'");
}
else
@ -1477,56 +1491,58 @@ sub executable_setup () {
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
if ( $mysql_version_id >= 50100 )
{
$exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
}
if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
{
$exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
}
else
{
$exe_mysql_upgrade= "";
}
if ( ! $glob_win32 )
if (!$opt_extern)
{
# Look for mysql_fix_system_table script
$exe_mysql_fix_system_tables=
mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
"$path_client_bindir/mysql_fix_privilege_tables");
}
# Look for mysql_fix_privilege_tables.sql script
$file_mysql_fix_privilege_tables=
mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
"$glob_basedir/share/mysql_fix_privilege_tables.sql");
# Look for SQL scripts directory
$path_sql_dir= mtr_path_exists("$glob_basedir/share",
"$glob_basedir/scripts");
if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
{
mtr_warning("Could not find all required ndb binaries, " .
"all ndb tests will fail, use --skip-ndbcluster to " .
"skip testing it.");
foreach my $cluster (@{$clusters})
{
$cluster->{"executable_setup_failed"}= 1;
if ( $mysql_version_id >= 50100 ) {
$exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
}
if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server ) {
$exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
} else {
$exe_mysql_upgrade= "";
}
}
if ( ! $opt_skip_im and executable_setup_im())
{
mtr_warning("Could not find all required instance manager binaries, " .
"all im tests will fail, use --skip-im to " .
"continue without instance manager");
$instance_manager->{"executable_setup_failed"}= 1;
}
if ( ! $glob_win32 ) {
# Look for mysql_fix_system_table script
$exe_mysql_fix_system_tables=
mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
"$path_client_bindir/mysql_fix_privilege_tables");
}
# Look for the udf_example library
$lib_udf_example=
mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
"$glob_basedir/sql/.libs/udf_example.so",);
# Look for mysql_fix_privilege_tables.sql script
$file_mysql_fix_privilege_tables=
mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
"$glob_basedir/share/mysql_fix_privilege_tables.sql");
if ( ! $opt_skip_ndbcluster and executable_setup_ndb()) {
mtr_warning("Could not find all required ndb binaries, " .
"all ndb tests will fail, use --skip-ndbcluster to " .
"skip testing it.");
foreach my $cluster (@{$clusters}) {
$cluster->{"executable_setup_failed"}= 1;
}
}
if ( ! $opt_skip_im and executable_setup_im()) {
mtr_warning("Could not find all required instance manager binaries, " .
"all im tests will fail, use --skip-im to " .
"continue without instance manager");
$instance_manager->{"executable_setup_failed"}= 1;
}
# Look for the udf_example library
$lib_udf_example=
mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
"$glob_basedir/sql/.libs/udf_example.so",);
}
# Look for mysqltest executable
if ( $glob_use_embedded_server )
@ -1563,7 +1579,8 @@ sub executable_setup () {
sub generate_cmdline_mysqldump ($) {
my($mysqld) = @_;
return
"$exe_mysqldump --no-defaults -uroot " .
mtr_native_path($exe_mysqldump) .
" --no-defaults -uroot " .
"--port=$mysqld->{'port'} " .
"--socket=$mysqld->{'path_sock'} --password=";
}
@ -1593,7 +1610,7 @@ sub mysql_client_test_arguments()
mtr_add_arg($args, "--port=$master->[0]->{'port'}");
mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
if ( $mysql_version_id >= 50000 )
if ( $opt_extern || $mysql_version_id >= 50000 )
{
mtr_add_arg($args, "--vardir=$opt_vardir")
}
@ -1697,14 +1714,14 @@ sub environment_setup () {
my $deb_version;
if ( $opt_valgrind and -d $debug_libraries_path and
(! -e '/etc/debian_version' or
($deb_version= mtr_grab_file('/etc/debian_version')) == 0 or
($deb_version= mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or
$deb_version > 3.1 ) )
{
push(@ld_library_paths, $debug_libraries_path);
}
$ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths,
$ENV{'LD_LIBRARY_PATHS'} ?
$ENV{'LD_LIBRARY_PATH'} ?
split(':', $ENV{'LD_LIBRARY_PATH'}) : ());
mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
@ -1801,9 +1818,10 @@ sub environment_setup () {
# Setup env so childs can execute mysqlcheck
# ----------------------------------------------------
my $cmdline_mysqlcheck=
"$exe_mysqlcheck --no-defaults -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
mtr_native_path($exe_mysqlcheck) .
" --no-defaults -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
if ( $opt_debug )
{
@ -1835,7 +1853,8 @@ sub environment_setup () {
if ( $exe_mysqlslap )
{
my $cmdline_mysqlslap=
"$exe_mysqlslap -uroot " .
mtr_native_path($exe_mysqlslap) .
" -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password= " .
"--lock-directory=$opt_tmpdir";
@ -1852,7 +1871,8 @@ sub environment_setup () {
# Setup env so childs can execute mysqlimport
# ----------------------------------------------------
my $cmdline_mysqlimport=
"$exe_mysqlimport -uroot " .
mtr_native_path($exe_mysqlimport) .
" -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
@ -1868,7 +1888,8 @@ sub environment_setup () {
# Setup env so childs can execute mysqlshow
# ----------------------------------------------------
my $cmdline_mysqlshow=
"$exe_mysqlshow -uroot " .
mtr_native_path($exe_mysqlshow) .
" -uroot " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
@ -1883,9 +1904,9 @@ sub environment_setup () {
# Setup env so childs can execute mysqlbinlog
# ----------------------------------------------------
my $cmdline_mysqlbinlog=
"$exe_mysqlbinlog" .
mtr_native_path($exe_mysqlbinlog) .
" --no-defaults --local-load=$opt_tmpdir";
if ( $mysql_version_id >= 50000 )
if (!$opt_extern && $mysql_version_id >= 50000 )
{
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
}
@ -1901,7 +1922,8 @@ sub environment_setup () {
# Setup env so childs can execute mysql
# ----------------------------------------------------
my $cmdline_mysql=
"$exe_mysql --no-defaults --host=localhost --user=root --password= " .
mtr_native_path($exe_mysql) .
" --no-defaults --host=localhost --user=root --password= " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} ".
"--character-sets-dir=$path_charsetsdir";
@ -1916,7 +1938,7 @@ sub environment_setup () {
# ----------------------------------------------------
# Setup env so childs can execute mysql_upgrade
# ----------------------------------------------------
if ( $mysql_version_id >= 50000 )
if ( !$opt_extern && $mysql_version_id >= 50000 )
{
$ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments();
}
@ -1924,7 +1946,7 @@ sub environment_setup () {
# ----------------------------------------------------
# Setup env so childs can execute mysql_fix_system_tables
# ----------------------------------------------------
if ( ! $glob_win32 )
if ( !$opt_extern && ! $glob_win32 )
{
my $cmdline_mysql_fix_system_tables=
"$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
@ -1933,23 +1955,27 @@ sub environment_setup () {
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'}";
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
}
if (!$opt_extern)
{
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
}
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
# ----------------------------------------------------
# Setup env so childs can execute my_print_defaults
# ----------------------------------------------------
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
# ----------------------------------------------------
# Setup env so childs can execute mysqladmin
# ----------------------------------------------------
$ENV{'MYSQLADMIN'}= $exe_mysqladmin;
$ENV{'MYSQLADMIN'}= mtr_native_path($exe_mysqladmin);
# ----------------------------------------------------
# Setup env so childs can execute perror
# ----------------------------------------------------
$ENV{'MY_PERROR'}= $exe_perror;
$ENV{'MY_PERROR'}= mtr_native_path($exe_perror);
# ----------------------------------------------------
# Add the path where mysqld will find udf_example.so
@ -2107,6 +2133,16 @@ sub remove_stale_vardir () {
mtr_verbose("Removing $opt_vardir/");
rmtree("$opt_vardir/");
}
if ( $opt_mem )
{
# A symlink from var/ to $opt_mem will be set up
# remove the $opt_mem dir to assure the symlink
# won't point at an old directory
mtr_verbose("Removing $opt_mem");
rmtree($opt_mem);
}
}
else
{
@ -2238,7 +2274,10 @@ sub check_ssl_support ($) {
if ($opt_skip_ssl || $opt_extern)
{
mtr_report("Skipping SSL");
if (!$opt_extern)
{
mtr_report("Skipping SSL");
}
$opt_ssl_supported= 0;
$opt_ssl= 0;
return;
@ -2313,9 +2352,12 @@ sub vs_config_dirs ($$) {
sub check_ndbcluster_support ($) {
my $mysqld_variables= shift;
if ($opt_skip_ndbcluster)
if ($opt_skip_ndbcluster || $opt_extern)
{
mtr_report("Skipping ndbcluster");
if (!$opt_extern)
{
mtr_report("Skipping ndbcluster");
}
$opt_skip_ndbcluster_slave= 1;
return;
}
@ -2731,7 +2773,10 @@ sub initialize_servers () {
}
else
{
mtr_report("No need to create '$opt_vardir' it already exists");
if ($opt_verbose)
{
mtr_report("No need to create '$opt_vardir' it already exists");
}
}
}
else
@ -2849,42 +2894,13 @@ sub install_db ($$) {
my $type= shift;
my $data_dir= shift;
my $init_db_sql= "lib/init_db.sql";
my $init_db_sql_tmp= "/tmp/init_db.sql$$";
my $args;
mtr_report("Installing \u$type Database");
open(IN, $init_db_sql)
or mtr_error("Can't open $init_db_sql: $!");
open(OUT, ">", $init_db_sql_tmp)
or mtr_error("Can't write to $init_db_sql_tmp: $!");
while (<IN>)
{
chomp;
s/\@HOSTNAME\@/$glob_hostname/;
if ( /^\s*$/ )
{
print OUT "\n";
}
elsif (/;$/)
{
print OUT "$_\n";
}
else
{
print OUT "$_ ";
}
}
close OUT;
close IN;
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--bootstrap");
mtr_add_arg($args, "--console");
mtr_add_arg($args, "--skip-grant-tables");
mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
mtr_add_arg($args, "--datadir=%s", $data_dir);
mtr_add_arg($args, "--skip-innodb");
@ -2911,21 +2927,55 @@ sub install_db ($$) {
# --bootstrap, to accommodate this.
my $exe_mysqld_bootstrap = $ENV{'MYSQLD_BOOTSTRAP'} || $exe_mysqld;
# ----------------------------------------------------------------------
# export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args>
# ----------------------------------------------------------------------
$ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args);
# ----------------------------------------------------------------------
# Create the bootstrap.sql file
# ----------------------------------------------------------------------
my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
# Use the mysql database for system tables
mtr_tofile($bootstrap_sql_file, "use mysql");
# Add the offical mysql system tables
# for a production system
mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql",
$bootstrap_sql_file);
# Add the mysql system tables initial data
# for a production system
mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables_data.sql",
$bootstrap_sql_file);
# Add test data for timezone - this is just a subset, on a real
# system these tables will be populated either by mysql_tzinfo_to_sql
# or by downloading the timezone table package from our website
mtr_appendfile_to_file("$path_sql_dir/mysql_test_data_timezone.sql",
$bootstrap_sql_file);
# Fill help tables, just an empty file when running from bk repo
# but will be replaced by a real fill_help_tables.sql when
# building the source dist
mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql",
$bootstrap_sql_file);
# Log bootstrap command
my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
mtr_tofile($path_bootstrap_log,
"$exe_mysqld_bootstrap " . join(" ", @$args) . "\n");
if ( mtr_run($exe_mysqld_bootstrap, $args, $init_db_sql_tmp,
if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file,
$path_bootstrap_log, $path_bootstrap_log,
"", { append_log_file => 1 }) != 0 )
{
unlink($init_db_sql_tmp);
mtr_error("Error executing mysqld --bootstrap\n" .
"Could not install $type test DBs");
"Could not install system database from $bootstrap_sql_file\n" .
"see $path_bootstrap_log for errors");
}
unlink($init_db_sql_tmp);
}
@ -2993,6 +3043,7 @@ language = $path_language
character-sets-dir = $path_charsetsdir
basedir = $path_my_basedir
server_id = $server_id
shutdown-delay = 10
skip-stack-trace
skip-innodb
skip-ndbcluster
@ -3128,17 +3179,17 @@ sub do_before_run_mysqltest($)
unlink("$result_dir/$tname.log");
unlink("$result_dir/$tname.warnings");
if ( $mysql_version_id < 50000 )
if (!$opt_extern)
{
# Set environment variable NDB_STATUS_OK to 1
# if script decided to run mysqltest cluster _is_ installed ok
$ENV{'NDB_STATUS_OK'} = "1";
}
elsif ( $mysql_version_id < 50100 )
{
# Set environment variable NDB_STATUS_OK to YES
# if script decided to run mysqltest cluster _is_ installed ok
$ENV{'NDB_STATUS_OK'} = "YES";
if ( $mysql_version_id < 50000 ) {
# Set environment variable NDB_STATUS_OK to 1
# if script decided to run mysqltest cluster _is_ installed ok
$ENV{'NDB_STATUS_OK'} = "1";
} elsif ( $mysql_version_id < 50100 ) {
# Set environment variable NDB_STATUS_OK to YES
# if script decided to run mysqltest cluster _is_ installed ok
$ENV{'NDB_STATUS_OK'} = "YES";
}
}
}
@ -3743,7 +3794,7 @@ sub mysqld_arguments ($$$$$) {
if ( $mysql_version_id <= 50106 )
{
# Force mysqld to use log files up until 5.1.6
mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'});
mtr_add_arg($args, "%s--log=%s", $prefix, $slave->[0]->{'path_mylog'});
}
else
{
@ -4629,7 +4680,8 @@ sub run_mysqltest ($) {
# ----------------------------------------------------------------------
# export MYSQL_TEST variable containing <path>/mysqltest <args>
# ----------------------------------------------------------------------
$ENV{'MYSQL_TEST'}= "$exe_mysqltest " . join(" ", @$args);
$ENV{'MYSQL_TEST'}=
mtr_native_path($exe_mysqltest) . " " . join(" ", @$args);
# ----------------------------------------------------------------------
# Add arguments that should not go into the MYSQL_TEST env var
@ -4840,9 +4892,7 @@ sub debugger_arguments {
my $exe= shift;
my $debugger= $opt_debugger || $opt_client_debugger;
# FIXME Need to change the below "eq"'s to
# "case unsensitive string contains"
if ( $debugger eq "vcexpress" or $debugger eq "vc")
if ( $debugger =~ /vcexpress|vc|devenv/ )
{
# vc[express] /debugexe exe arg1 .. argn
@ -4850,22 +4900,37 @@ sub debugger_arguments {
unshift(@$$args, "/debugexe");
unshift(@$$args, "$$exe");
# Set exe to debuggername
$$exe= $debugger;
}
elsif ( $debugger eq "windbg" )
elsif ( $debugger =~ /windbg/ )
{
# windbg exe arg1 .. argn
# Add name of the exe before args
unshift(@$$args, "$$exe");
# Set exe to debuggername
$$exe= $debugger;
}
elsif ( $debugger eq "dbx" )
{
# xterm -e dbx -r exe arg1 .. argn
unshift(@$$args, $$exe);
unshift(@$$args, "-r");
unshift(@$$args, $debugger);
unshift(@$$args, "-e");
$$exe= "xterm";
}
else
{
mtr_error("Unknown argument \"$debugger\" passed to --debugger");
}
# Set exe to debuggername
$$exe= $debugger;
}
@ -4919,10 +4984,10 @@ sub usage ($) {
if ( $message )
{
print STDERR "$message \n";
print STDERR "$message\n";
}
print STDERR <<HERE;
print <<HERE;
$0 [ OPTIONS ] [ TESTCASE ]

View File

@ -0,0 +1,43 @@
[ndbd default]
NoOfReplicas= 1
MaxNoOfConcurrentTransactions= 64
MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
DataMemory= CHOOSE_DataMemory
IndexMemory= CHOOSE_IndexMemory
Diskless= CHOOSE_Diskless
TimeBetweenWatchDogCheck= 30000
DataDir= CHOOSE_FILESYSTEM
MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes
TimeBetweenGlobalCheckpoints= 500
NoOfFragmentLogFiles= 3
#
# Increase deadlock-timeout to cater for slow test-machines
# (possibly running several tests in parallell)
#
#TransactionDeadlockDetectionTimeout= 7500
[ndbd]
HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
[ndb_mgmd]
HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
DataDir= CHOOSE_FILESYSTEM #
PortNumber= CHOOSE_PORT_MGM
[mysqld]
[mysqld]
[mysqld]
[mysqld]
[mysqld]
[mysqld]
[mysqld]
[mysqld]

View File

@ -1,5 +1,6 @@
[ndbd default]
NoOfReplicas= 2
MaxNoOfConcurrentTransactions= 64
MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
DataMemory= CHOOSE_DataMemory
IndexMemory= CHOOSE_IndexMemory
@ -7,6 +8,15 @@ Diskless= CHOOSE_Diskless
TimeBetweenWatchDogCheck= 30000
DataDir= CHOOSE_FILESYSTEM
MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes
TimeBetweenGlobalCheckpoints= 500
NoOfFragmentLogFiles= 3
#
# Increase deadlock-timeout to cater for slow test-machines
# (possibly running several tests in parallell)
#
#TransactionDeadlockDetectionTimeout= 7500
[ndbd]
HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress

View File

@ -0,0 +1,52 @@
[ndbd default]
NoOfReplicas= 2
MaxNoOfConcurrentTransactions= 64
MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
DataMemory= CHOOSE_DataMemory
IndexMemory= CHOOSE_IndexMemory
Diskless= CHOOSE_Diskless
TimeBetweenWatchDogCheck= 30000
DataDir= CHOOSE_FILESYSTEM
MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes
TimeBetweenGlobalCheckpoints= 500
NoOfFragmentLogFiles= 3
#
# Increase deadlock-timeout to cater for slow test-machines
# (possibly running several tests in parallell)
#
#TransactionDeadlockDetectionTimeout= 7500
[ndbd]
HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
[ndbd]
HostName= CHOOSE_HOSTNAME_2 # hostname is a valid network adress
[ndbd]
HostName= CHOOSE_HOSTNAME_3 # hostname is a valid network adress
[ndbd]
HostName= CHOOSE_HOSTNAME_4 # hostname is a valid network adress
[ndb_mgmd]
HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
DataDir= CHOOSE_FILESYSTEM #
PortNumber= CHOOSE_PORT_MGM
[mysqld]
[mysqld]
[mysqld]
[mysqld]
[mysqld]
[mysqld]
[mysqld]
[mysqld]

View File

@ -63,12 +63,17 @@ stop_ndb=
initial_ndb=
status_ndb=
ndb_diskless=0
ndbd_nodes=2
relative_config_data_dir=
opt_core=
ndb_no_ord=512
ndb_no_attr=2048
ndb_con_op=105000
ndb_dmem=80M
ndb_imem=24M
VERBOSE=100
NDB_MGM_EXTRA_OPTS=
NDB_MGMD_EXTRA_OPTS=
NDBD_EXTRA_OPTS=
@ -89,6 +94,9 @@ while test $# -gt 0; do
--debug*)
flags_ndb="$flags_ndb $1"
;;
--ndbd-nodes=*)
ndbd_nodes=`echo "$1" | sed -e "s;--ndbd-nodes=;;"`
;;
--status)
status_ndb=1
;;
@ -104,6 +112,9 @@ while test $# -gt 0; do
--data-dir=*)
fsdir=`echo "$1" | sed -e "s;--data-dir=;;"`
;;
--relative-config-data-dir)
relative_config_data_dir=1
;;
--port=*)
port=`echo "$1" | sed -e "s;--port=;;"`
;;
@ -122,6 +133,12 @@ while test $# -gt 0; do
--character-sets-dir=*)
CHARSETSDIR=`echo "$1" | sed -e "s;--character-sets-dir=;;"`
;;
--core)
opt_core="--core"
;;
--verbose=*)
VERBOSE=`echo "$1" | sed -e "s;--verbose=;;"`
;;
-- ) shift; break ;;
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
* ) break ;;
@ -130,9 +147,10 @@ while test $# -gt 0; do
done
fs_ndb="$fsdir/ndbcluster-$port"
config_ini=ndb/ndb_config_${ndbd_nodes}_node.ini
NDB_HOME=
if [ ! -x "$fsdir" ]; then
if [ ! -d "$fsdir" ]; then
echo "$fsdir missing"
exit 1
fi
@ -148,11 +166,15 @@ if [ ! -x "$exec_waiter" ]; then
echo "$exec_waiter missing"
exit 1
fi
if [ ! -f "$config_ini" ]; then
echo "$config_ini missing, unsupported number of nodes"
exit 1
fi
exec_mgmtclient="$exec_mgmtclient --no-defaults $NDB_MGM_EXTRA_OPTS"
exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults $NDB_MGMD_EXTRA_OPTS"
exec_ndb="$exec_ndb --no-defaults $NDBD_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR"
exec_waiter="$exec_waiter --no-defaults"
exec_mgmtclient="$exec_mgmtclient --no-defaults $opt_core $NDB_MGM_EXTRA_OPTS"
exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults $opt_core $NDB_MGMD_EXTRA_OPTS"
exec_ndb="$exec_ndb --no-defaults $opt_core $NDBD_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR"
exec_waiter="$exec_waiter --no-defaults $opt_core"
ndb_host="localhost"
ndb_mgmd_port=$port
@ -196,18 +218,24 @@ fi
# Start management server as deamon
# Edit file system path and ports in config file
if [ $relative_config_data_dir ] ; then
config_fs_ndb="."
else
config_fs_ndb=$fs_ndb
fi
if [ $initial_ndb ] ; then
rm -f $fs_ndb/ndb_* 2>&1 | cat > /dev/null
rm -rf $fs_ndb/ndb_* 2>&1 | cat > /dev/null
sed \
-e s,"CHOOSE_MaxNoOfAttributes","$ndb_no_attr",g \
-e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \
-e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \
-e s,"CHOOSE_DataMemory","$ndb_dmem",g \
-e s,"CHOOSE_IndexMemory","$ndb_imem",g \
-e s,"CHOOSE_Diskless","$ndb_diskless",g \
-e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \
-e s,"CHOOSE_FILESYSTEM","$fs_ndb",g \
-e s,"CHOOSE_FILESYSTEM","$config_fs_ndb",g \
-e s,"CHOOSE_PORT_MGM","$ndb_mgmd_port",g \
< ndb/ndb_config_2_node.ini \
< "$config_ini" \
> "$fs_ndb/config.ini"
fi
@ -218,7 +246,7 @@ if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else
echo "Unable to start $exec_mgmtsrvr from `pwd`"
exit 1
fi
if sleep_until_file_created $fs_ndb/ndb_3.pid 120
if sleep_until_file_created $fs_ndb/ndb_`expr $ndbd_nodes + 1`.pid 120
then :; else
exit 1
fi
@ -226,38 +254,43 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# Start database node
echo "Starting ndbd"
( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
if sleep_until_file_created $fs_ndb/ndb_1.pid 120
then :; else
stop_default_ndbcluster
exit 1
fi
cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
# Start database node
echo "Starting ndbd"
( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
if sleep_until_file_created $fs_ndb/ndb_2.pid 120
then :; else
stop_default_ndbcluster
exit 1
fi
cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
id=1
while [ $id -le $ndbd_nodes ]
do
if [ `expr $VERBOSE \> 1` = 1 ] ; then
echo "Starting ndbd $id($ndbd_nodes)"
fi
( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
if sleep_until_file_created $fs_ndb/ndb_${id}.pid 120
then :; else
stop_default_ndbcluster
exit 1
fi
cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
id=`expr $id + 1`
done
# test if Ndb Cluster starts properly
echo "Waiting for NDB data nodes to start..."
if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK" > /dev/null 2>&1; then :; else
echo "Ndbcluster startup failed"
if [ `expr $VERBOSE \> 1` = 1 ] ; then
echo "Waiting for NDB data nodes to start..."
fi
if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK" > /dev/null 2>&1 ; then :; else
if [ `expr $VERBOSE \> 0` = 1 ] ; then
echo "Ndbcluster startup failed"
fi
stop_default_ndbcluster
exit 1
fi
if [ `expr $VERBOSE \> 1` = 1 ] ; then
echo "Ok"
fi
cat `find "$fs_ndb" -name 'ndb_*.pid'` > $fs_ndb/$pidfile
status_ndbcluster
if [ `expr $VERBOSE \> 2` = 1 ] ; then
status_ndbcluster
fi
}
status_ndbcluster() {

View File

@ -446,7 +446,7 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert IGNORE into t1 values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
create table t1 (fl geometry);
create table t1 (fl geometry not null);
insert into t1 values (1);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (1.11);
@ -454,5 +454,5 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (pointfromtext('point(1,1)'));
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
ERROR 23000: Column 'fl' cannot be null
drop table t1;

View File

@ -1442,7 +1442,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c c 11 const # Using where
explain select count(*) from t1 where t='a ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range t t 13 NULL # Using where
1 SIMPLE t1 ref t t 13 const # Using where
explain select count(*) from t1 where v like 'a%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 13 NULL # Using where

View File

@ -446,7 +446,7 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert IGNORE into t1 values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
create table t1 (fl geometry);
create table t1 (fl geometry not null);
insert into t1 values (1);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (1.11);
@ -454,5 +454,5 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (pointfromtext('point(1,1)'));
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
ERROR 23000: Column 'fl' cannot be null
drop table t1;

View File

@ -123,3 +123,14 @@ master-bin.000001 # Query 1 # use `test`; create table t3 like t1
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t3
master-bin.000001 # Query 1 # use `test`; replace into t1 select * from t3
drop table t1,t2,t3;
CREATE TABLE t1(a INT, b INT) ENGINE=BLACKHOLE;
DELETE FROM t1 WHERE a=10;
ALTER TABLE t1 ADD INDEX(a);
DELETE FROM t1 WHERE a=10;
ALTER TABLE t1 DROP INDEX a;
ALTER TABLE t1 ADD UNIQUE INDEX(a);
DELETE FROM t1 WHERE a=10;
ALTER TABLE t1 DROP INDEX a;
ALTER TABLE t1 ADD PRIMARY KEY(a);
DELETE FROM t1 WHERE a=10;
DROP TABLE t1;

View File

@ -0,0 +1,8 @@
drop table if exists t1;
drop table t1;
drop table t1;
ERROR 42S02: Unknown table 't1'
set @my_max_allowed_packet= @@max_allowed_packet;
set global max_allowed_packet=100*@@max_allowed_packet;
set global max_allowed_packet=@my_max_allowed_packet;
drop table t1;

Some files were not shown because too many files have changed in this diff Show More