1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_cmpfunc.h:
  Auto merged
sql/item_subselect.h:
  Auto merged
sql/sql_derived.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_union.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.h:
  Auto merged
mysql-test/r/subselect.result:
  merging (wiil be fixed after building)
sql/item_subselect.cc:
  merging
sql/sql_select.cc:
  merging
This commit is contained in:
unknown
2003-06-25 23:52:15 +03:00
350 changed files with 14454 additions and 15810 deletions

View File

@ -277,6 +277,7 @@ help.h
include/my_config.h
include/my_global.h
include/mysql_version.h
include/readline/*.h
include/readline/readline.h
include/widec.h
innobase/autom4te-2.53.cache/output.0
@ -347,6 +348,7 @@ libmysqld/item_buff.cc
libmysqld/item_cmpfunc.cc
libmysqld/item_create.cc
libmysqld/item_func.cc
libmysqld/item_geofunc.cc
libmysqld/item_row.cc
libmysqld/item_strfunc.cc
libmysqld/item_sum.cc
@ -397,6 +399,7 @@ libmysqld/sql_rename.cc
libmysqld/sql_repl.cc
libmysqld/sql_select.cc
libmysqld/sql_show.cc
libmysqld/sql_state.c
libmysqld/sql_string.cc
libmysqld/sql_table.cc
libmysqld/sql_test.cc
@ -503,6 +506,7 @@ scripts/make_win_src_distribution
scripts/msql2mysql
scripts/mysql_config
scripts/mysql_convert_table_format
scripts/mysql_create_system_tables
scripts/mysql_explain_log
scripts/mysql_find_rows
scripts/mysql_fix_extensions
@ -549,6 +553,7 @@ sql-bench/test-select
sql-bench/test-transactions
sql-bench/test-wisconsin
sql/.gdbinit
sql/client.c
sql/gen_lex_hash
sql/gmon.out
sql/lex_hash.h
@ -583,6 +588,7 @@ stamp-h4
strings/conf_to_src
strings/ctype_autoconf.c
strings/ctype_extra_sources.c
strings/str_test
support-files/MacOSX/Description.plist
support-files/MacOSX/Info.plist
support-files/MacOSX/ReadMe.txt
@ -616,4 +622,3 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
include/readline/*.h

View File

@ -71,6 +71,22 @@ else
make=make
fi
if test -z $CXX ; then
if test -z "$CXX" ; then
CXX=gcc
fi
# If ccache (a compiler cache which reduces build time)
# (http://samba.org/ccache) is installed, use it.
# We use 'grep' and hope 'grep' will work as expected
# (returns 0 if finds lines)
if ccache -V > /dev/null 2>&1
then
if ! (echo "$CC" | grep "ccache" > /dev/null)
then
CC="ccache $CC"
fi
if ! (echo "$CXX" | grep "ccache" > /dev/null)
then
CXX="ccache $CXX"
fi
fi

View File

@ -17,6 +17,7 @@ bar@gw.udmsearch.izhnet.ru
bell@laptop.sanja.is.com.ua
bell@sanja.is.com.ua
bk@admin.bk
carsten@tsort.bitbybit.dk
davida@isil.mysql.com
gluh@gluh.(none)
gluh@gluh.mysql.r18.ru
@ -29,9 +30,11 @@ heikki@rescue.
heikki@work.mysql.com
hf@bison.(none)
hf@bisonxp.(none)
hf@deer.(none)
hf@deer.mysql.r18.ru
hf@genie.(none)
igor@hundin.mysql.fi
igor@rurik.mysql.com
jani@dsl-jkl1657.dial.inet.fi
jani@dsl-kpogw4gb5.dial.inet.fi
jani@hynda.(none)
@ -39,6 +42,7 @@ jani@hynda.mysql.fi
jani@janikt.pp.saunalahti.fi
jani@rhols221.adsl.netsonic.fi
jani@rhols221.arenanet.fi
jani@ua126d19.elisa.omakaista.fi
jcole@abel.spaceapes.com
jcole@main.burghcom.com
jcole@mugatu.spaceapes.com
@ -48,6 +52,7 @@ jorge@linux.jorge.mysql.com
kaj@work.mysql.com
lenz@kallisto.mysql.com
lenz@mysql.com
miguel@hegel.(none)
miguel@hegel.br
miguel@hegel.local
miguel@light.
@ -74,6 +79,7 @@ nick@mysql.com
nick@nick.leippe.com
papa@gbichot.local
paul@central.snake.net
paul@ice.snake.net
paul@teton.kitebird.com
pem@mysql.com
peter@linux.local
@ -93,6 +99,7 @@ sasha@mysql.sashanet.com
serg@build.mysql2.com
serg@serg.mylan
serg@serg.mysql.com
serg@sergbook.mylan
serg@sergbook.mysql.com
sinisa@rhols221.adsl.netsonic.fi
tfr@beta.frontier86.ee
@ -114,6 +121,7 @@ venu@myvenu.com
venu@work.mysql.com
vva@eagle.mysql.r18.ru
vva@genie.(none)
vva@mysql.r18.ru
walrus@kishkin.ru
walrus@mysql.com
wax@kishkin.ru

View File

@ -1,3 +0,0 @@
#! /bin/sh
echo "Test: post-incoming works"

View File

@ -1,3 +0,0 @@
#! /bin/sh
echo "Test: post-outgoing works"

12
BitKeeper/triggers/pre-commit Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
if [ "$REAL_EMAIL" = "" ]
then
echo "Error: you must set REAL_EMAIL in your profile"
echo "e.g.: export REAL_EMAIL='Joe Dow <joe@foo.bar>'"
echo ""
echo "Commit FAILED!"
echo "Set REAL_EMAIL and retry."
exit 1
fi

View File

@ -156,54 +156,6 @@ manual_letter.de.ps: manual.de.texi include.texi
$(DVIPS) -t letter manual.de.dvi -o $@
touch $@
#
# Internals Manual
#
# GNU Info
internals.info: internals.texi include.texi
cd $(srcdir) && $(MAKEINFO) --no-split -I $(srcdir) $<
# Plain Text
internals.txt: internals.texi include.texi
cd $(srcdir) && \
$(MAKEINFO) -I $(srcdir) --no-headers --no-split --output $@ $<
# HTML, all in one file
internals.html: internals.texi include.texi $(srcdir)/Support/texi2html
cd $(srcdir) && @PERL@ $(srcdir)/Support/texi2html $(TEXI2HTML_FLAGS) $<
internals_toc.html: internals.html
# PDF, Portable Document Format
internals.pdf: internals.texi
sed -e 's|@image{[^}]*} *||g' <$< >internals-tmp.texi
pdftex --interaction=nonstopmode internals-tmp.texi
texindex internals-tmp.??
pdftex --interaction=nonstopmode internals-tmp.texi
texindex internals-tmp.??
pdftex --interaction=nonstopmode internals-tmp.texi
mv internals-tmp.pdf $@
rm -f internals-tmp.*
touch $@
# Postscript, A4 Paper
internals_a4.ps: internals.texi include.texi
TEXINPUTS=$(srcdir):$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' \
$(TEXI2DVI) --batch --texinfo --quiet '@afourpaper' $<
$(DVIPS) -t a4 internals.dvi -o $@
touch $@
# Postscript, US Letter Paper
internals_letter.ps: internals.texi include.texi
TEXINPUTS=$(srcdir):$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' \
$(TEXI2DVI) --batch $<
$(DVIPS) -t letter internals.dvi -o $@
touch $@
#
# Miscellaneous
#

File diff suppressed because it is too large Load Diff

221
INSTALL-WIN-SOURCE Executable file
View File

@ -0,0 +1,221 @@
#########################################################
# #
# HOWTO : INSTALL MySQL FROM SOURCE #
# WINDOWS PORT #
# #
# Copyright (C) MySQL AB 1995-2003 #
#########################################################
This is a simple 'HOWTO' document describing how to
build MySQL binaries for versions 4.1 and above on
Windows. Instructions are provided for building binaries
from a standard source distribution or from the BitKeeper
tree that contains the latest development source.
---------------------------------------------------------
NOTE
---------------------------------------------------------
Normally, it is best to use precompiled binary distributions
of MySQL that are built specifically for optimal performance
on Windows by MySQL AB. Binary distributions are available
from:
http://www.mysql.com/downloads/
The instructions in this document are strictly for users
who want to test MySQL on Windows from the latest source or
from the BitKeeper tree, and for internal MySQL developers.
--------------------------------------------------------
TABLE OF CONTENTS
--------------------------------------------------------
1. REQUIREMENTS
2. OBTAINING A WINDOWS SOURCE DISTRIBUTION
3. CREATING A SOURCE PACKAGE FROM THE 'BitKeeper' TREE
4. BUILDING 'mysql server and clients' FROM VC++ WORKSPACE
5. BUILDING FROM 'nmake' MAKEFILES
6. STARTING THE MYSQL SERVER FOR THE FIRST TIME
7. TESTING THE CONNECTION
8. SPECIAL NOTES AND CONSIDERATIONS
-------------------------------------------------------
1. REQUIREMENTS
-------------------------------------------------------
To build MySQL on Windows from source, you need the
following compiler and resources available on your Windows
system:
- Microsoft Visual C++ 6.0 and above
- ~45 MB disk space
- 64 MB RAM
You'll also need a MySQL source distribution, which you
can obtain as described in section 2.
-------------------------------------------------------
2. OBTAINING A WINDOWS SOURCE DISTRIBUTION
-------------------------------------------------------
There are two ways you can get a Windows source distribution
for MySQL version 4.1 and above:
I. Obtain a MySQL AB-distributed source distribution for the
particular version of MySQL in which you are interested.
Prepackaged source distributions are available for released
versions of MySQL and can be obtained from:
http://www.mysql.com/downloads/
II. Alternatively, you can package a source distribution
yourself from the latest BitKeeper developer source
tree. If you plan to do this, you must create the
package on a Unix system and then transfer it to your
Windows system. (The reason for this is that some of the
configuration and build steps require tools that work only
on Unix.) The BitKeeper approach thus requires:
- A system running Unix, or a Unix-like system such as Linux
- BitKeeper 3.0 installed on that system (you can obtain
BitKeeper from http://www.bitkeeper.com)
If you are using the first option, you can skip the next
section and go directly to "BUILDING 'mysql server & clients'
FROM VC++ WORKSPACE"
-------------------------------------------------------
3. CREATING A SOURCE PACKAGE FROM THE 'BitKeeper' TREE
-------------------------------------------------------
To build the latest Windows source package from the current
BitKeeper source tree, use the following instructions. Please
note that this procedure must be performed on a system
running a Unix or Unix-like operating system. (The procedure
is know to work well on Linux, for example.
- Clone the BitKeeper source tree for MySQL (version 4.1
or above, as desired). For more information how to clone
the source tree, see the instructions at:
http://www.mysql.com/doc/en/Installing_source_tree.html
- Configure and build the distribution so that you have a
server binary to work with. One way to do this is to run
the following command in the top-level directory of your
source tree:
./BUILD/compile-pentium-max
- After making sure that the build process completed successfully,
run the following utility script from top-level directory
of your source tree:
./scripts/make_win_src_distribution
This script creates a Windows source package, to be used on
your Windows system. You can supply different options to the
script based on your needs. It accepts the following options:
--debug Debug, without creating the package
--tmp Specify the temporary location
--suffix Suffix name for the package
--dirname Directory name to copy files (intermediate)
--silent Do not list verbosely files processed
--tar Create tar.gz package instead of .zip
--help Show this help message
By default, make_win_src_distribution creates a zipped
archive with the name mysql-$version-win-src.zip, where
$version represents the version of your MySQL source tree.
- Copy or upload to your Windows machine the Windows source
package that you have just created. To compile it, use
the instructions in the next section.
---------------------------------------------------------
4. BUILDING 'mysql server & clients' FROM VC++ WORKSPACE
---------------------------------------------------------
NOTE: MySQL 4.1 and above VC++ workspace files are compatible
with Microsoft Visual Studio 6.0 and above(7.0/.NET)
editions and tested by MySQL folks before each
release.
Unpack the Windows source zipped archive to a folder and open
mysql.dsw from your top-level directory.
If you want to build both release and debug versions, then
select 'build' -> 'buildall' option. To build only release
or debug versions, select all appropriate workspaces from
the 'build' -> 'batch build' option.
The simplest solution to building the basic clients and core
server is to set your current active workspace as 'mysqld'
release or debug version, and just hit 'build' or 'F7', which
creates the necessary client binaries in the 'client_release'
or 'client_debug' directories. The libraries are placed in the
'lib_release' and 'lib_debug' directories for release and
debug versions, respectively.
Now you have built the distribution. If you get any compiler
errors, please cross check and email the compiler output to
win32@lists.mysql.com for further assistance.
---------------------------------------------------------
5. BUILDING FROM 'nmake' MAKEFILES
---------------------------------------------------------
TODO from MySQL PIEFU team.
---------------------------------------------------------
6. STARTING THE MYSQL SERVER FOR THE FIRST TIME
---------------------------------------------------------
The server built using the preceding instructions will
expect that the MySQL base directory and data directory
are C:\mysql and C:\mysql\data by default. If you want to
test your server using the source root directory and its
data directory as the base directory and data directory,
you will need to tell the server their pathnames. You can
either do this on the command line with the --basedir
and --data-dir options, or place appropriate options in
an option file (C:\my.cnf or the my.ini file in your
Windows directory). If you have an existing data directory
elsewhere that you want to use, you can specify its pathname
instead.
Start your server from the 'client_release' or 'client_debug'
directory (depending on which server you want to use). The
general instructions are given here:
http://www.mysql.com/doc/en/Windows_installation.html
You'll have to adapt the instructions appropriately if you
want to use a different base directory and/or data directory.
That's all!!! See, it's as simple to build MySQL on Windows
as on any other platform!!!
---------------------------------------------------------
7. TESTING THE CONNECTION
---------------------------------------------------------
Once the server is running in standalone fashion or as a
service based on your configuration, try to connect to it
from the 'mysql' command line SQL interactive utility that
exists in your 'client_release' or 'client_debug' directory.
---------------------------------------------------------
8. SPECIAL NOTES AND CONSIDERATIONS
---------------------------------------------------------
- For production use, MySQL AB does not advise using a MySQL
server built by yourself from source. It is preferable to
stick to using binaries shipped by MySQL AB.
- If you find something not working as expected, or you have
suggestions about ways to improve the current build process
on Windows, please email to win32@lists.mysql.com.
Thanks
MySQL Team

View File

@ -22,7 +22,7 @@ AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = INSTALL-SOURCE README \
COPYING COPYING.LIB
SUBDIRS = . include @docs_dirs@ \
@readline_topdir@ \
@readline_topdir@ sql-common \
@thread_dirs@ pstack @sql_client_dirs@ \
@sql_server_dirs@ scripts man tests \
BUILD @netware_dir@ os2 @libmysqld_dirs@ \
@ -70,7 +70,10 @@ linked_netware_sources:
#avoid recursive make calls in sql directory
linked_server_sources:
cd sql; rm -f mini_client_errors.c;@LN_CP_F@ ../libmysql/errmsg.c mini_client_errors.c; rm -f pack.c;@LN_CP_F@ ../sql-common/pack.c pack.c
cd sql; rm -f mini_client_errors.c;\
@LN_CP_F@ ../libmysql/errmsg.c mini_client_errors.c;\
rm -f pack.c;@LN_CP_F@ ../sql-common/pack.c pack.c;\
rm -f client.c;@LN_CP_F@ ../sql-common/client.c client.c
echo timestamp > linked_server_sources
# Create permission databases

View File

@ -87,7 +87,7 @@ LINK32=link.exe
# Name "mysql - Win32 Debug"
# Begin Source File
SOURCE=..\mysys\my_gethostbyname.c
SOURCE=.\completion_hash.cpp
# End Source File
# Begin Source File
@ -101,6 +101,14 @@ SOURCE=.\mysql.cpp
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\readline.cpp
# End Source File
# Begin Source File
SOURCE=.\sql_string.cpp
# End Source File
# End Target
# End Project

View File

@ -25,7 +25,7 @@ CFG=mysqlclient - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "mysqlclient - Win32 Release"
@ -48,7 +48,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=xilink6.exe -lib
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_release\mysqlclient.lib"
@ -72,7 +72,7 @@ LIB32=xilink6.exe -lib
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=xilink6.exe -lib
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_debug\mysqlclient.lib"
@ -104,11 +104,7 @@ SOURCE=..\mysys\charset.c
# End Source File
# Begin Source File
SOURCE=.\completion_hash.cpp
# End Source File
# Begin Source File
SOURCE=.\completion_hash.h
SOURCE=..\libmysql\client.c
# End Source File
# Begin Source File
@ -422,30 +418,14 @@ SOURCE=..\libmysql\password.c
# End Source File
# Begin Source File
SOURCE=.\readline.cpp
# End Source File
# Begin Source File
SOURCE=..\mysys\safemalloc.c
# End Source File
# Begin Source File
SOURCE=.\select_test.c
# End Source File
# Begin Source File
SOURCE=..\mysys\sha1.c
# End Source File
# Begin Source File
SOURCE=.\sql_string.cpp
# End Source File
# Begin Source File
SOURCE=.\sql_string.h
# End Source File
# Begin Source File
SOURCE=..\strings\str2int.c
# End Source File
# Begin Source File

View File

@ -123,6 +123,10 @@ SOURCE=..\mysys\charset.c
# End Source File
# Begin Source File
SOURCE=.\client.c
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-big5.c"
# End Source File
# Begin Source File
@ -215,10 +219,6 @@ SOURCE=.\libmysql.c
# End Source File
# Begin Source File
SOURCE=.\pack.c
# End Source File
# Begin Source File
SOURCE=.\Libmysql.def
# End Source File
# Begin Source File
@ -403,6 +403,10 @@ SOURCE=..\sql\net_serv.cpp
# End Source File
# Begin Source File
SOURCE=.\pack.c
# End Source File
# Begin Source File
SOURCE=.\password.c
# End Source File
# Begin Source File
@ -411,10 +415,6 @@ SOURCE=..\mysys\safemalloc.c
# End Source File
# Begin Source File
SOURCE=..\client\select_test.c
# End Source File
# Begin Source File
SOURCE=..\mysys\sha1.c
# End Source File
# Begin Source File

View File

@ -55,8 +55,20 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\client\completion_hash.cpp
# End Source File
# Begin Source File
SOURCE=..\..\client\mysql.cpp
# End Source File
# Begin Source File
SOURCE=..\..\client\readline.cpp
# End Source File
# Begin Source File
SOURCE=..\..\client\sql_string.cpp
# End Source File
# End Group
# Begin Source File

View File

@ -1,65 +1,130 @@
LIBRARY LIBMYSQLD
DESCRIPTION 'MySQL 4.0 Embedded Server Library'
VERSION 4.0
DESCRIPTION 'MySQL 4.1 Embedded Server Library'
VERSION 4.1
EXPORTS
mysql_server_end
mysql_server_init
mysql_use_result
mysql_thread_safe
mysql_thread_id
mysql_store_result
mysql_stat
mysql_shutdown
mysql_select_db
mysql_row_tell
mysql_row_seek
mysql_real_query
mysql_real_connect
mysql_query
mysql_ping
mysql_options
mysql_num_rows
mysql_num_fields
mysql_list_tables
mysql_list_processes
mysql_list_fields
mysql_list_dbs
mysql_kill
mysql_insert_id
mysql_init
mysql_info
mysql_get_server_info
mysql_get_proto_info
mysql_get_host_info
mysql_get_client_info
mysql_free_result
mysql_field_tell
_dig_vec
bmove_upp
delete_dynamic
free_defaults
getopt_compare_strings
getopt_ull_limit_value
handle_options
init_dynamic_array
insert_dynamic
int2str
is_prefix
list_add
list_delete
load_defaults
max_allowed_packet
my_end
my_getopt_print_errors
my_init
my_malloc
my_memdup
my_no_flags_free
my_path
my_print_help
my_print_variables
my_realloc
my_strdup
my_thread_end
my_thread_init
myodbc_remove_escape
mysql_affected_rows
mysql_autocommit
mysql_change_user
mysql_character_set_name
mysql_close
mysql_commit
mysql_data_seek
mysql_debug
mysql_dump_debug_info
mysql_eof
mysql_errno
mysql_error
mysql_escape_string
mysql_fetch_field
mysql_fetch_field_direct
mysql_fetch_fields
mysql_fetch_lengths
mysql_fetch_row
mysql_field_count
mysql_field_seek
mysql_fetch_row
mysql_fetch_lengths
mysql_fetch_fields
mysql_fetch_field_direct
mysql_fetch_field
mysql_escape_string
mysql_real_escape_string
mysql_error
mysql_errno
mysql_eof
mysql_dump_debug_info
mysql_drop_db
mysql_debug
mysql_data_seek
mysql_create_db
mysql_character_set_name
mysql_change_user
mysql_connect
mysql_close
mysql_affected_rows
mysql_thread_init
mysql_thread_end
mysql_send_query
mysql_read_query_result
mysql_refresh
mysql_field_tell
mysql_free_result
mysql_get_client_info
mysql_get_host_info
mysql_get_proto_info
mysql_get_server_info
mysql_info
mysql_init
mysql_insert_id
mysql_kill
mysql_list_dbs
mysql_list_fields
mysql_list_processes
mysql_list_tables
mysql_more_results
mysql_next_result
mysql_num_fields
mysql_num_rows
mysql_odbc_escape_string
myodbc_remove_escape
mysql_options
mysql_ping
mysql_query
mysql_read_query_result
mysql_real_connect
mysql_real_escape_string
mysql_real_query
mysql_refresh
mysql_rollback
mysql_row_seek
mysql_row_tell
mysql_select_db
mysql_send_query
mysql_shutdown
mysql_ssl_set
mysql_stat
mysql_store_result
mysql_sqlstate
mysql_thread_id
mysql_thread_safe
mysql_use_result
mysql_warning_count
net_buffer_length
set_dynamic
strcend
strcont
strdup_root
strfill
strinstr
strmake
strmov
strxmov
mysql_server_end
mysql_server_init
get_tty_password
sql_protocol_typelib
mysql_get_server_version
mysql_sqlstate
charsets_dir
disabled_my_option
my_charset_latin1
init_alloc_root
my_progname
get_charset_by_csname
print_defaults
find_type
strxnmov
strend
my_fopen
my_fclose
unpack_filename
str2int
int10_to_str
longlong10_to_str
my_snprintf_8bit
alloc_root
free_root
my_read

View File

@ -43,7 +43,8 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMYSQLD_EXPORTS" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "__WIN__" /FR /FD /mktyplib203 /win32 # ADD BASE MTL /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../sql" /I "../regex" /I "../bdb/build_win32" /I "../zlib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "__WIN__" /FR /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x416 /d "NDEBUG"
# ADD RSC /l 0x416 /d "NDEBUG"
@ -68,7 +69,8 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMYSQLD_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MT /W3 /Gm /Zi /Od /I "../include" /I "../sql" /I "../regex" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /FD /GZ /mktyplib203 /win32 # ADD BASE MTL /c
# ADD CPP /nologo /MT /W3 /Gm /Zi /Od /I "../include" /I "../sql" /I "../regex" /I "../bdb/build_win32" /I "../zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x416 /d "_DEBUG"
# ADD RSC /l 0x416 /d "_DEBUG"
@ -87,7 +89,11 @@ LINK32=link.exe
# Name "libmysqld - Win32 Debug"
# Begin Source File
SOURCE=..\sql\convert.cpp
SOURCE="..\strings\ctype-latin1.c"
# End Source File
# Begin Source File
SOURCE=..\mysys\default.c
# End Source File
# Begin Source File
@ -111,7 +117,7 @@ SOURCE=..\sql\filesort.cpp
# End Source File
# Begin Source File
SOURCE=..\libmysql\get_password.c
SOURCE=..\client\get_password.c
# End Source File
# Begin Source File
@ -159,6 +165,10 @@ SOURCE=..\sql\init.cpp
# End Source File
# Begin Source File
SOURCE=..\strings\int2str.c
# End Source File
# Begin Source File
SOURCE=..\sql\item.cpp
# End Source File
# Begin Source File
@ -180,6 +190,10 @@ SOURCE=..\sql\item_func.cpp
# End Source File
# Begin Source File
SOURCE=.\item_geofunc.cpp
# End Source File
# Begin Source File
SOURCE=.\item_row.cpp
# End Source File
# Begin Source File
@ -236,7 +250,11 @@ SOURCE=..\sql\mf_iocache.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\mini_client.cpp
SOURCE=..\mysys\my_alloc.c
# End Source File
# Begin Source File
SOURCE=..\mysys\my_getopt.c
# End Source File
# Begin Source File
@ -256,6 +274,10 @@ SOURCE=..\sql\opt_sum.cpp
# End Source File
# Begin Source File
SOURCE=..\libmysql\pack.c
# End Source File
# Begin Source File
SOURCE=..\libmysql\password.c
# End Source File
# Begin Source File
@ -380,6 +402,10 @@ SOURCE=..\sql\sql_show.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\sql_state.c
# End Source File
# Begin Source File
SOURCE=..\sql\sql_string.cpp
# End Source File
# Begin Source File
@ -408,6 +434,26 @@ SOURCE=..\sql\sql_yacc.cpp
# End Source File
# Begin Source File
SOURCE=..\strings\str2int.c
# End Source File
# Begin Source File
SOURCE=..\strings\strcend.c
# End Source File
# Begin Source File
SOURCE=..\strings\strcont.c
# End Source File
# Begin Source File
SOURCE=..\strings\strinstr.c
# End Source File
# Begin Source File
SOURCE=..\strings\strxnmov.c
# End Source File
# Begin Source File
SOURCE=..\sql\table.cpp
# End Source File
# Begin Source File

View File

@ -193,6 +193,10 @@ SOURCE=.\mi_panic.c
# End Source File
# Begin Source File
SOURCE=.\mi_preload.c
# End Source File
# Begin Source File
SOURCE=.\mi_range.c
# End Source File
# Begin Source File

View File

@ -725,19 +725,10 @@ Package=<5>
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name strings
End Project Dependency
Begin Project Dependency
Project_Dep_Name mysys
End Project Dependency
Begin Project Dependency
Project_Dep_Name libmysqld
End Project Dependency
Begin Project Dependency
Project_Dep_Name vio
End Project Dependency
Begin Project Dependency
Project_Dep_Name zlib
End Project Dependency
}}}

View File

@ -88,6 +88,10 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\mysys\mf_tempdir.c
# End Source File
# Begin Source File
SOURCE=..\client\mysqlbinlog.cpp
# End Source File
# End Group

View File

@ -84,10 +84,6 @@ LIB32=xilink6.exe -lib
# Name "mysqldemb - Win32 Debug"
# Begin Source File
SOURCE=..\sql\convert.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\derror.cpp
# End Source File
# Begin Source File
@ -220,10 +216,6 @@ SOURCE=..\sql\mf_iocache.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\mini_client.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\net_serv.cpp
# End Source File
# Begin Source File

View File

@ -28,7 +28,7 @@ CFG=mysqld - Win32 Release
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "mysqld - Win32 Release"
@ -45,14 +45,14 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../zlib" /I "../include" /I "../regex" /D "NDEBUG" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x410 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"../client_release/mysqld-opt.exe"
# SUBTRACT LINK32 /debug
@ -71,14 +71,14 @@ LINK32=xilink6.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../regex" /I "../bdb/build_win32" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /FD /c
# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /FD /c
# SUBTRACT CPP /Fr /YX
# ADD BASE RSC /l 0x410 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_debug\dbug.lib ..\lib_debug\vio.lib ..\lib_debug\isam.lib ..\lib_debug\merge.lib ..\lib_debug\mysys.lib ..\lib_debug\strings.lib ..\lib_debug\regex.lib ..\lib_debug\heap.lib ..\lib_debug\bdb.lib ..\lib_debug\innodb.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqld.exe" /pdbtype:sept
@ -98,14 +98,14 @@ LINK32=xilink6.exe
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MT /W3 /O2 /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "__WIN32__" /D "DBUG_OFF" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../zlib" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "USE_SYMDIR" /D "HAVE_DLOPEN" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x410 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\dbug.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\zlib.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-nt.exe"
# SUBTRACT LINK32 /pdb:none /debug
@ -126,14 +126,14 @@ LINK32=xilink6.exe
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../bdb/build_win32" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../zlib" /D "NDEBUG" /D "__NT__" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\zlib.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-nt.exe"
# SUBTRACT BASE LINK32 /pdb:none /debug
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys-max.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\zlib.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-max-nt.exe"
@ -155,14 +155,14 @@ LINK32=xilink6.exe
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /D "NDEBUG" /D "DBUG_OFF" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../bdb/build_win32" /D "NDEBUG" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "USE_SYMDIR" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /out:"../client_release/mysqld-opt.exe"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys-max.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib ..\lib_release\zlib.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"../client_release/mysqld-max.exe"
# SUBTRACT LINK32 /debug
@ -178,7 +178,7 @@ LINK32=xilink6.exe
# Name "mysqld - Win32 Max"
# Begin Source File
SOURCE=.\convert.cpp
SOURCE=.\client.c
!IF "$(CFG)" == "mysqld - Win32 Release"
@ -486,6 +486,10 @@ SOURCE=.\item_func.cpp
# End Source File
# Begin Source File
SOURCE=.\item_geofunc.cpp
# End Source File
# Begin Source File
SOURCE=.\item_row.cpp
# End Source File
# Begin Source File
@ -656,10 +660,6 @@ SOURCE=.\mf_iocache.cpp
# End Source File
# Begin Source File
SOURCE=.\mini_client.cpp
# End Source File
# Begin Source File
SOURCE=..\myisammrg\myrg_rnext_same.c
# End Source File
# Begin Source File
@ -742,6 +742,10 @@ SOURCE=.\OPT_SUM.cpp
# End Source File
# Begin Source File
SOURCE=.\pack.c
# End Source File
# Begin Source File
SOURCE=.\password.c
!IF "$(CFG)" == "mysqld - Win32 Release"
@ -889,6 +893,10 @@ SOURCE=.\sql_class.cpp
# End Source File
# Begin Source File
SOURCE=.\sql_client.cpp
# End Source File
# Begin Source File
SOURCE=.\sql_crypt.cpp
# End Source File
# Begin Source File
@ -1133,6 +1141,10 @@ SOURCE=.\sql_show.cpp
# End Source File
# Begin Source File
SOURCE=.\sql_state.c
# End Source File
# Begin Source File
SOURCE=.\sql_string.cpp
!IF "$(CFG)" == "mysqld - Win32 Release"

View File

@ -19,7 +19,10 @@
#undef CRAY_STACKSEG_END
/* Define the default charset name */
#undef DEFAULT_CHARSET_NAME
#undef MYSQL_DEFAULT_CHARSET_NAME
/* Define the default charset name */
#undef MYSQL_DEFAULT_COLLATION_NAME
/* Version of .frm files */
#undef DOT_FRM_VERSION

View File

@ -44,7 +44,7 @@
#include <locale.h>
#endif
const char *VER= "14.0";
const char *VER= "14.1";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
@ -139,7 +139,7 @@ static my_string opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE;
static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0,
*default_charset= (char*) MYSQL_CHARSET;
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
static char *histfile;
static String glob_buffer,old_buffer;
static String processed_prompt;
@ -200,7 +200,9 @@ static int com_nopager(String *str, char*), com_pager(String *str, char*),
static int read_lines(bool execute_commands);
static int sql_connect(char *host,char *database,char *user,char *password,
uint silent);
static int put_info(const char *str,INFO_TYPE info,uint error=0);
static int put_info(const char *str,INFO_TYPE info,uint error=0,
const char *sql_state=0);
static int put_error(MYSQL *mysql);
static void safe_put_field(const char *pos,ulong length);
static void xmlencode_print(const char *src, uint length);
static void init_pager();
@ -561,12 +563,12 @@ static struct my_option my_long_options[] =
{"prompt", OPT_PROMPT, "Set the mysql prompt to this value.",
(gptr*) &current_prompt, (gptr*) &current_prompt, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory)",
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q',
"Don't cache result, print it row by row. This may slow down the server if the output is suspended. Doesn't use history file. ",
"Don't cache result, print it row by row. This may slow down the server if the output is suspended. Doesn't use history file.",
(gptr*) &quick, (gptr*) &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"raw", 'r', "Write fields without conversion. Used with --batch",
{"raw", 'r', "Write fields without conversion. Used with --batch.",
(gptr*) &opt_raw_data, (gptr*) &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable with --disable-reconnect. This option is enabled by default.",
@ -575,7 +577,7 @@ static struct my_option my_long_options[] =
0, 0},
#ifdef HAVE_SMEM
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"socket", 'S', "Socket file to use for connection.",
@ -599,7 +601,7 @@ static struct my_option my_long_options[] =
{"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.",
(gptr*) &safe_updates, (gptr*) &safe_updates, 0, GET_BOOL, OPT_ARG, 0, 0,
0, 0, 0, 0},
{"verbose", 'v', "Write more. (-v -v -v gives the table output format)", 0,
{"verbose", 'v', "Write more. (-v -v -v gives the table output format).", 0,
0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -1437,7 +1439,7 @@ int mysql_real_query_for_lazy(const char *buf, int length)
{
if (!mysql_real_query(&mysql,buf,length))
return 0;
uint error=put_info(mysql_error(&mysql),INFO_ERROR, mysql_errno(&mysql));
int error= put_error(&mysql);
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1 ||
!opt_reconnect)
return error;
@ -1452,11 +1454,20 @@ int mysql_store_result_for_lazy(MYSQL_RES **result)
return 0;
if (mysql_error(&mysql)[0])
return put_info(mysql_error(&mysql),INFO_ERROR,mysql_errno(&mysql));
return put_error(&mysql);
return 0;
}
static void print_help_item(MYSQL_ROW *cur, int num_name, int num_cat, char *last_char)
{
char ccat= (*cur)[num_cat][0];
if (*last_char != ccat)
{
put_info(ccat == 'Y' ? "categories :" : "topics :", INFO_INFO);
*last_char= ccat;
}
tee_fprintf(PAGER, " %s\n", (*cur)[num_name]);
}
static int com_server_help(String *buffer __attribute__((unused)),
char *line __attribute__((unused)), char *help_arg)
@ -1465,6 +1476,7 @@ static int com_server_help(String *buffer __attribute__((unused)),
const char *server_cmd= buffer->ptr();
char cmd_buf[100];
MYSQL_RES *result;
MYSQL_FIELD *fields;
int error;
if (help_arg[0] != '\'')
@ -1482,15 +1494,16 @@ static int com_server_help(String *buffer __attribute__((unused)),
if (!connected && reconnect())
return 1;
if ((error= mysql_real_query_for_lazy(server_cmd,strlen(server_cmd))))
return error;
if ((error= mysql_store_result_for_lazy(&result)))
if ((error= mysql_real_query_for_lazy(server_cmd,strlen(server_cmd))) ||
(error= mysql_store_result_for_lazy(&result)))
return error;
if (result)
{
ulonglong num_rows= mysql_num_rows(result);
if (num_rows == 1)
unsigned int num_fields= mysql_num_fields(result);
my_ulonglong num_rows= mysql_num_rows(result);
fields= mysql_fetch_fields(result);
if (num_fields==3 && num_rows==1)
{
if (!(cur= mysql_fetch_row(result)))
{
@ -1499,46 +1512,48 @@ static int com_server_help(String *buffer __attribute__((unused)),
}
init_pager();
if (cur[1][0] == 'Y')
{
tee_fprintf(PAGER, "Help topic \'%s\'\n", cur[0]);
tee_fprintf(PAGER, "%s\n", cur[2]);
tee_fprintf(PAGER, "For help on specific function please type 'help <function>'\nwhere function is one of next:\n%s\n", cur[3]);
}
else
{
tee_fprintf(PAGER, "Name: \'%s\'\n\n", cur[0]);
tee_fprintf(PAGER, "Description:\n%s\n\n", cur[2]);
if (cur[3])
tee_fprintf(PAGER, "Examples:\n%s\n", cur[3]);
}
tee_fprintf(PAGER, "Name: \'%s\'\n", cur[0]);
tee_fprintf(PAGER, "Description:\n%s", cur[1]);
if (cur[2] && *((char*)cur[2]))
tee_fprintf(PAGER, "Examples:\n%s", cur[2]);
tee_fprintf(PAGER, "\n");
end_pager();
}
else if (num_rows > 1)
else if (num_fields >= 2 && num_rows)
{
put_info("Many help items for your request exist", INFO_INFO);
put_info("For more specific request please type 'help <item>' where item is one of next:", INFO_INFO);
init_pager();
char last_char= '_';
while ((cur= mysql_fetch_row(result)))
char last_char;
int num_name, num_cat;
LINT_INIT(num_name);
LINT_INIT(num_cat);
if (num_fields == 2)
{
if (cur[1][0]!=last_char)
{
put_info("-------------------------------------------", INFO_INFO);
put_info(cur[1][0] == 'Y' ?
"categories:" : "functions:", INFO_INFO);
put_info("-------------------------------------------", INFO_INFO);
}
last_char= cur[1][0];
tee_fprintf(PAGER, "%s\n", cur[0]);
put_info("Many help items for your request exist", INFO_INFO);
put_info("For more specific request please type 'help <item>' where item is one of next", INFO_INFO);
num_name= 0;
num_cat= 1;
last_char= '_';
}
else if ((cur= mysql_fetch_row(result)))
{
tee_fprintf(PAGER, "You asked help about help category: \"%s\"\n", cur[0]);
put_info("For a more information type 'help <item>' where item is one of the following", INFO_INFO);
num_name= 1;
num_cat= 2;
print_help_item(&cur,1,2,&last_char);
}
while ((cur= mysql_fetch_row(result)))
print_help_item(&cur,num_name,num_cat,&last_char);
tee_fprintf(PAGER, "\n");
end_pager();
}
else
{
put_info("\nNothing found\n", INFO_INFO);
put_info("\nNothing found", INFO_INFO);
put_info("Please try to run 'help contents' for list of all accessible topics\n", INFO_INFO);
}
}
@ -1653,9 +1668,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
if (quick)
{
if (!(result=mysql_use_result(&mysql)) && mysql_field_count(&mysql))
{
return put_info(mysql_error(&mysql),INFO_ERROR,mysql_errno(&mysql));
}
return put_error(&mysql);
}
else
{
@ -1717,7 +1730,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
put_info("",INFO_RESULT); // Empty row
if (result && !mysql_eof(result)) /* Something wrong when using quick */
error=put_info(mysql_error(&mysql),INFO_ERROR,mysql_errno(&mysql));
error= put_error(&mysql);
else if (unbuffered)
fflush(stdout);
mysql_free_result(result);
@ -1793,9 +1806,8 @@ print_field_types(MYSQL_RES *result)
MYSQL_FIELD *field;
while ((field = mysql_fetch_field(result)))
{
tee_fprintf(PAGER,"%s '%s' %d %d %d %d %d\n",
field->name,
field->table ? "" : field->table,
tee_fprintf(PAGER,"'%s.%s.%s.%s' %d %d %d %d %d\n",
field->catalog, field->db, field->table, field->name,
(int) field->type,
field->length, field->max_length,
field->flags, field->decimals);
@ -1832,7 +1844,7 @@ print_table_data(MYSQL_RES *result)
separator.fill(separator.length()+length+2,'-');
separator.append('+');
}
tee_puts(separator.c_ptr(), PAGER);
tee_puts(separator.c_ptr_safe(), PAGER);
if (column_names)
{
mysql_field_seek(result,0);
@ -2432,12 +2444,12 @@ com_use(String *buffer __attribute__((unused)), char *line)
if (mysql_select_db(&mysql,tmp))
{
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR)
return put_info(mysql_error(&mysql),INFO_ERROR,mysql_errno(&mysql));
return put_error(&mysql);
if (reconnect())
return opt_reconnect ? -1 : 1; // Fatal error
if (mysql_select_db(&mysql,tmp))
return put_info(mysql_error(&mysql),INFO_ERROR,mysql_errno(&mysql));
return put_error(&mysql);
}
my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
current_db=my_strdup(tmp,MYF(MY_WME));
@ -2550,6 +2562,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
select_limit,max_join_size);
mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command);
}
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (!mysql_real_connect(&mysql, host, user, password,
database, opt_mysql_port, opt_mysql_unix_port,
connect_flag | CLIENT_MULTI_QUERIES))
@ -2558,7 +2571,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
(mysql_errno(&mysql) != CR_CONN_HOST_ERROR &&
mysql_errno(&mysql) != CR_CONNECTION_ERROR))
{
put_info(mysql_error(&mysql),INFO_ERROR,mysql_errno(&mysql));
(void) put_error(&mysql);
(void) fflush(stdout);
return ignore_errors ? -1 : 1; // Abort
}
@ -2708,7 +2721,7 @@ select_limit, max_join_size);
static int
put_info(const char *str,INFO_TYPE info_type,uint error)
put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
{
FILE *file= (info_type == INFO_ERROR ? stderr : stdout);
static int inited=0;
@ -2753,7 +2766,12 @@ put_info(const char *str,INFO_TYPE info_type,uint error)
putchar('\007'); /* This should make a bell */
vidattr(A_STANDOUT);
if (error)
(void) tee_fprintf(file, "ERROR %d: ", error);
{
if (sqlstate)
(void) tee_fprintf(file, "ERROR %d (%s): ", error, sqlstate);
else
(void) tee_fprintf(file, "ERROR %d: ", error);
}
else
tee_puts("ERROR: ", file);
}
@ -2768,6 +2786,14 @@ put_info(const char *str,INFO_TYPE info_type,uint error)
}
static int
put_error(MYSQL *mysql)
{
return put_info(mysql_error(mysql), INFO_ERROR, mysql_errno(mysql),
mysql_sqlstate(mysql));
}
static void remove_cntrl(String &buffer)
{
char *start,*end;
@ -2918,14 +2944,18 @@ static const char* construct_prompt()
add_int_to_prompt(++prompt_counter);
break;
case 'v':
processed_prompt.append(mysql_get_server_info(&mysql));
if (connected)
processed_prompt.append(mysql_get_server_info(&mysql));
else
processed_prompt.append("not_connected");
break;
case 'd':
processed_prompt.append(current_db ? current_db : "(none)");
break;
case 'h':
{
const char *prompt=mysql_get_host_info(&mysql);
const char *prompt;
prompt= connected ? mysql_get_host_info(&mysql) : "not_connected";
if (strstr(prompt, "Localhost"))
processed_prompt.append("localhost");
else
@ -2937,8 +2967,13 @@ static const char* construct_prompt()
}
case 'p':
#ifndef EMBEDDED_LIBRARY
if (!connected)
{
processed_prompt.append("not_connected");
break;
}
if (strstr(mysql_get_host_info(&mysql),"TCP/IP") ||
! mysql.unix_socket)
!mysql.unix_socket)
add_int_to_prompt(mysql.port);
else
{
@ -3086,4 +3121,3 @@ void sql_element_free(void *ptr)
my_free((gptr) ptr,MYF(0));
}
#endif /* EMBEDDED_LIBRARY */

View File

@ -113,16 +113,16 @@ static TYPELIB command_typelib=
static struct my_option my_long_options[] =
{
{"count", 'c',
"Number of iterations to make. This works with -i (--sleep) only",
"Number of iterations to make. This works with -i (--sleep) only.",
(gptr*) &nr_iterations, (gptr*) &nr_iterations, 0, GET_UINT,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'",
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
"Don't ask for confirmation on drop database; with multiple commands, continue even if an error occurs.",
(gptr*) &option_force, (gptr*) &option_force, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol",
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
@ -130,7 +130,7 @@ static struct my_option my_long_options[] =
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host", (gptr*) &host, (gptr*) &host, 0, GET_STR,
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
@ -141,7 +141,7 @@ static struct my_option my_long_options[] =
#endif
{"port", 'P', "Port number to use for connection.", (gptr*) &tcp_port,
(gptr*) &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory)",
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relative", 'r',
"Show difference between current and previous values when used with -i. Currently works only with extended-status.",
@ -152,10 +152,10 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Silently exit if one can't connect to server",
{"silent", 's', "Silently exit if one can't connect to server.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
(gptr*) &unix_port, (gptr*) &unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
@ -170,13 +170,13 @@ static struct my_option my_long_options[] =
#endif
{"verbose", 'v', "Write more information.", (gptr*) &opt_verbose,
(gptr*) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit", 0, 0, 0, GET_NO_ARG,
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"vertical", 'E',
"Print output vertically. Is similar to --relative, but prints output vertically.",
(gptr*) &opt_vertical, (gptr*) &opt_vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"wait", 'w', "Wait and retry if connection is down", 0, 0, 0, GET_UINT,
{"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_UINT,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"connect_timeout", OPT_CONNECT_TIMEOUT, "", (gptr*) &opt_connect_timeout,
(gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0,

View File

@ -199,37 +199,37 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log.", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"database", 'd', "List entries for just this database (local log only)",
{"database", 'd', "List entries for just this database (local log only).",
(gptr*) &database, (gptr*) &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"force-read", 'f', "Force reading unknown binlog events",
{"force-read", 'f', "Force reading unknown binlog events.",
(gptr*) &force_opt, (gptr*) &force_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"help", '?', "Display this help and exit",
{"help", '?', "Display this help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Get the binlog from server", (gptr*) &host, (gptr*) &host,
{"host", 'h', "Get the binlog from server.", (gptr*) &host, (gptr*) &host,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"offset", 'o', "Skip the first N entries", (gptr*) &offset, (gptr*) &offset,
{"offset", 'o', "Skip the first N entries.", (gptr*) &offset, (gptr*) &offset,
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p', "Password to connect to remote server",
{"password", 'p', "Password to connect to remote server.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Use port to connect to the remote server",
{"port", 'P', "Use port to connect to the remote server.",
(gptr*) &port, (gptr*) &port, 0, GET_INT, REQUIRED_ARG, MYSQL_PORT, 0, 0,
0, 0, 0},
{"position", 'j', "Start reading the binlog at position N",
{"position", 'j', "Start reading the binlog at position N.",
(gptr*) &position, (gptr*) &position, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"result-file", 'r', "Direct output to a given file", 0, 0, 0, GET_STR,
{"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"short-form", 's', "Just show the queries, no extra info",
{"short-form", 's', "Just show the queries, no extra info.",
(gptr*) &short_form, (gptr*) &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"table", 't', "Get raw table dump using COM_TABLE_DUMB", (gptr*) &table,
{"table", 't', "Get raw table dump using COM_TABLE_DUMB.", (gptr*) &table,
(gptr*) &table, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "Connect to the remote server as username",
{"user", 'u', "Connect to the remote server as username.",
(gptr*) &user, (gptr*) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"local-load", 'l', "Prepare files for local load in directory",
{"local-load", 'l', "Prepare files for local load in directory.",
(gptr*) &dirname_for_local_load, (gptr*) &dirname_for_local_load, 0,
GET_STR_ALLOC, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,

View File

@ -38,7 +38,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
static uint verbose = 0, opt_mysql_port=0;
static my_string opt_mysql_unix_port = 0;
static char *opt_password = 0, *current_user = 0,
*default_charset = (char *)MYSQL_CHARSET, *current_host = 0;
*default_charset = (char *)MYSQL_DEFAULT_CHARSET_NAME,
*current_host = 0;
static int first_error = 0;
DYNAMIC_ARRAY tables4repair;
#ifdef HAVE_SMEM
@ -66,9 +67,9 @@ static struct my_option my_long_options[] =
(gptr*) &opt_auto_repair, (gptr*) &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0,
0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are", (gptr*) &charsets_dir,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"check", 'c', "Check table for errors", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
{"check", 'c', "Check table for errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{"check-only-changed", 'C',
"Check only tables that have changed since last check or haven't been closed properly.",
@ -80,12 +81,12 @@ static struct my_option my_long_options[] =
"To check several databases. Note the difference in usage; In this case no tables are given. All name arguments are regarded as databasenames.",
(gptr*) &opt_databases, (gptr*) &opt_databases, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'",
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set", (gptr*) &default_charset,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fast",'F', "Check only tables that haven't been closed properly",
{"fast",'F', "Check only tables that haven't been closed properly.",
(gptr*) &opt_fast, (gptr*) &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"force", 'f', "Continue even if we get an sql-error.",
@ -114,7 +115,7 @@ static struct my_option my_long_options[] =
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory)",
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q',
"If you are using this option with CHECK TABLE, it prevents the check from scanning the rows to check for wrong links. This is the fastest check. If you are using this option with REPAIR TABLE, it will try to repair only the index tree. This is the fastest repair method for a table.",
@ -125,7 +126,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Print only error messages.", (gptr*) &opt_silent,

View File

@ -34,6 +34,7 @@
** XML by Gary Huntress <ghuntress@mediaone.net> 10/10/01, cleaned up
** and adapted to mysqldump 05/11/01 by Jani Tolonen
** Added --single-transaction option 06/06/2002 by Peter Zaitsev
** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
*/
#define DUMP_VERSION "10.2"
@ -77,7 +78,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1,
lock_tables=1,ignore_errors=0,flush_logs=0,replace=0,
ignore=0,opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0,
opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0,
opt_alldbs=0,opt_create_db=0,opt_first_slave=0,
opt_alldbs=0,opt_create_db=0,opt_first_slave=0,opt_set_names=0,
opt_autocommit=0,opt_master_data,opt_disable_keys=1,opt_xml=0,
opt_delete_master_logs=0, tty_password=0,
opt_single_transaction=0;
@ -85,7 +86,7 @@ static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
*where=0, *default_charset= (char *)MYSQL_CHARSET,
*where=0, *default_charset= (char *) "binary",
*opt_compatible_mode_str= 0,
*err_ptr= 0;
static ulong opt_compatible_mode= 0;
@ -131,7 +132,7 @@ static struct my_option my_long_options[] =
"Allow creation of column names that are keywords.", (gptr*) &opt_keywords,
(gptr*) &opt_keywords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are", (gptr*) &charsets_dir,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compatible", OPT_COMPATIBLE,
"Change the dump to be compatible with a given mode. By default tables are dumped without any restrictions. Legal modes are: mysql323, mysql40, postgresql, oracle, mssql, db2, sapdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option does a no operation on earlier server versions.",
@ -205,13 +206,17 @@ static struct my_option my_long_options[] =
(gptr*) &opt_single_transaction, (gptr*) &opt_single_transaction, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-create-db", 'n',
"'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' will not be put in the output. The above line will be added otherwise, if --databases or --all-databases option was given.}",
"'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' will not be put in the output. The above line will be added otherwise, if --databases or --all-databases option was given.}.",
(gptr*) &opt_create_db, (gptr*) &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"no-create-info", 't', "Don't write table creation info.",
(gptr*) &tFlag, (gptr*) &tFlag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-data", 'd', "No row information.", (gptr*) &dFlag, (gptr*) &dFlag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-set-names", 'N',
"'SET NAMES charset_name' will not be put in the output.",
(gptr*) &opt_set_names, (gptr*) &opt_set_names, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -222,17 +227,17 @@ static struct my_option my_long_options[] =
"Password to use when connecting to server. If password is not given it's solicited on the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __WIN__
{"pipe", 'W', "Use named pipes to connect to server", 0, 0, 0, GET_NO_ARG,
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory)",
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"quick", 'q', "Don't buffer query, dump directly to stdout.",
(gptr*) &quick, (gptr*) &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"quote-names",'Q', "Quote table and column names with a `",
{"quote-names",'Q', "Quote table and column names with backticks (`).",
(gptr*) &opt_quoted, (gptr*) &opt_quoted, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"result-file", 'r',
@ -240,7 +245,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"skip-opt", OPT_SKIP_OPTIMIZATION,
@ -345,6 +350,8 @@ static void write_header(FILE *sql_file, char *db_name)
sql_file);
fprintf(sql_file, "-- Server version\t%s\n",
mysql_get_server_info(&mysql_connection));
if (!opt_set_names)
fprintf(sql_file,"\n/*!40101 SET NAMES %s*/;\n",default_charset);
}
return;
} /* write_header */
@ -428,6 +435,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char buff[255];
opt_quoted= 1;
opt_set_names= 1;
opt_compatible_mode_str= argument;
opt_compatible_mode= find_set(&compatible_mode_typelib,
argument, strlen(argument),
@ -557,6 +565,8 @@ static int dbConnect(char *host, char *user,char *passwd)
if (shared_memory_base_name)
mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif
if (!opt_set_names)
mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset);
if (!(sock= mysql_real_connect(&mysql_connection,host,user,passwd,
NULL,opt_mysql_port,opt_mysql_unix_port,
0)))

View File

@ -44,7 +44,7 @@ static char *opt_password=0, *current_user=0,
*current_host=0, *current_db=0, *fields_terminated=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0,
*escaped=0, *opt_columns=0,
*default_charset= (char*) MYSQL_CHARSET;
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
static uint opt_mysql_port=0;
static my_string opt_mysql_unix_port=0;
static my_string opt_ignore_lines=0;
@ -59,7 +59,7 @@ static uint opt_protocol=0;
static struct my_option my_long_options[] =
{
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are", (gptr*) &charsets_dir,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
@ -71,7 +71,7 @@ static struct my_option my_long_options[] =
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"debug",'#', "Output debug log. Often this is 'd:t:o,filename'", 0, 0, 0,
{"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"delete", 'd', "First delete all rows from table.", (gptr*) &opt_delete,
(gptr*) &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -102,12 +102,12 @@ static struct my_option my_long_options[] =
{"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
(gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"local", 'L', "Read all files through the client", (gptr*) &opt_local_file,
{"local", 'L', "Read all files through the client.", (gptr*) &opt_local_file,
(gptr*) &opt_local_file, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"lock-tables", 'l', "Lock all tables for write.", (gptr*) &lock_tables,
(gptr*) &lock_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"low-priority", OPT_LOW_PRIORITY,
"Use LOW_PRIORITY when updating the table", (gptr*) &opt_low_priority,
"Use LOW_PRIORITY when updating the table.", (gptr*) &opt_low_priority,
(gptr*) &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
@ -119,13 +119,13 @@ static struct my_option my_long_options[] =
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory)",
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replace", 'r', "If duplicate unique key was found, replace old row.",
(gptr*) &replace, (gptr*) &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Be more silent.", (gptr*) &silent, (gptr*) &silent, 0,

View File

@ -29,14 +29,14 @@ const char* outfile=0,*user="root";
static struct my_option my_long_options[] =
{
{"output-file", 'o', "Write the output to the file with the given name",
{"output-file", 'o', "Write the output to the file with the given name.",
(gptr*) &outfile, (gptr*) &outfile, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
{"user", 'u', "Put given user in the password file", (gptr*) &user,
{"user", 'u', "Put given user in the password file.", (gptr*) &user,
(gptr*) &user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this message and exit", 0, 0, 0, GET_NO_ARG, NO_ARG,
{"help", '?', "Display this message and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"version", 'V', "Display version info", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
{"version", 'V', "Display version info.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};

View File

@ -30,6 +30,7 @@
static my_string host=0,opt_password=0,user=0;
static my_bool opt_show_keys=0,opt_compress=0,opt_status=0, tty_password=0;
static uint opt_verbose=0;
static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
@ -115,6 +116,8 @@ int main(int argc, char **argv)
if (shared_memory_base_name)
mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (!(mysql_real_connect(&mysql,host,user,opt_password,
(first_argument_uses_wildcards) ? "" : argv[0],opt_mysql_port,opt_mysql_unix_port,
0)))
@ -152,13 +155,16 @@ int main(int argc, char **argv)
static struct my_option my_long_options[] =
{
{"character-sets-dir", 'c', "Directory where character sets are",
{"character-sets-dir", 'c', "Directory where character sets are.",
(gptr*) &charsets_dir, (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol",
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'",
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
@ -167,7 +173,7 @@ static struct my_option my_long_options[] =
{"status", 'i', "Shows a lot of extra information about each table.",
(gptr*) &opt_status, (gptr*) &opt_status, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"keys", 'k', "Show keys for table", (gptr*) &opt_show_keys,
{"keys", 'k', "Show keys for table.", (gptr*) &opt_show_keys,
(gptr*) &opt_show_keys, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
@ -179,11 +185,11 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory)",
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SMEM
{"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME,
"Base name of shared memory", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
"Base name of shared memory.", (gptr*) &shared_memory_base_name, (gptr*) &shared_memory_base_name,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"socket", 'S', "Socket file to use for connection.",
@ -558,7 +564,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
mysql_error(mysql));
return 1;
}
end=strmov(strmov(query,"show /*!32332 FULL */ columns from "),table);
end=strmov(strmov(strmov(query,"show /*!32332 FULL */ columns from `"),table),"`");
if (wild && wild[0])
strxmov(end," like '",wild,"'",NullS);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
@ -580,7 +586,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
print_res_top(result);
if (opt_show_keys)
{
end=strmov(strmov(query,"show keys from "),table);
end=strmov(strmov(strmov(query,"show keys from `"),table),"`");
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{
fprintf(stderr,"%s: Cannot list keys in db: %s, table: %s: %s\n",

View File

@ -42,7 +42,7 @@
**********************************************************************/
#define MTEST_VERSION "1.27"
#define MTEST_VERSION "1.28"
#include <my_global.h>
#include <mysql_embed.h>
@ -523,8 +523,12 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char* fname)
if (!my_stat(eval_file, &stat_info, MYF(MY_WME)))
die(NullS);
if (!eval_result && stat_info.st_size != ds->length)
if (!eval_result && (uint) stat_info.st_size != ds->length)
{
DBUG_PRINT("info",("Size differs: result size: %u file size: %u",
ds->length, stat_info.st_size));
DBUG_RETURN(2);
}
if (!(tmp = (char*) my_malloc(stat_info.st_size + 1, MYF(MY_WME))))
die(NullS);
@ -1804,34 +1808,34 @@ int read_query(struct st_query** q_ptr)
static struct my_option my_long_options[] =
{
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'",
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"basedir", 'b', "Basedir for tests", (gptr*) &opt_basedir,
{"basedir", 'b', "Basedir for tests.", (gptr*) &opt_basedir,
(gptr*) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"big-test", 'B', "Define BIG_TEST to 1", (gptr*) &opt_big_test,
{"big-test", 'B', "Define BIG_TEST to 1.", (gptr*) &opt_big_test,
(gptr*) &opt_big_test, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use the compressed server/client protocol",
{"compress", 'C', "Use the compressed server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"manager-user", OPT_MANAGER_USER, "Undocumented: Used for debugging",
{"manager-user", OPT_MANAGER_USER, "Undocumented: Used for debugging.",
(gptr*) &manager_user, (gptr*) &manager_user, 0, GET_STR, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
{"manager-host", OPT_MANAGER_HOST, "Undocumented: Used for debugging",
{"manager-host", OPT_MANAGER_HOST, "Undocumented: Used for debugging.",
(gptr*) &manager_host, (gptr*) &manager_host, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"manager-password", OPT_MANAGER_PASSWD, "Undocumented: Used for debugging",
{"manager-password", OPT_MANAGER_PASSWD, "Undocumented: Used for debugging.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"manager-port", OPT_MANAGER_PORT, "Undocumented: Used for debugging",
{"manager-port", OPT_MANAGER_PORT, "Undocumented: Used for debugging.",
(gptr*) &manager_port, (gptr*) &manager_port, 0, GET_INT, REQUIRED_ARG,
MYSQL_MANAGER_PORT, 0, 0, 0, 0, 0},
{"manager-wait-timeout", OPT_MANAGER_WAIT_TIMEOUT,
"Undocumented: Used for debugging", (gptr*) &manager_wait_timeout,
"Undocumented: Used for debugging.", (gptr*) &manager_wait_timeout,
(gptr*) &manager_wait_timeout, 0, GET_INT, REQUIRED_ARG, 3, 0, 0, 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},
@ -1844,16 +1848,16 @@ static struct my_option my_long_options[] =
{"result-file", 'R', "Read/Store result from/in this file.",
(gptr*) &result_file, (gptr*) &result_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"server-arg", 'A', "Send enbedded server this as a paramenter",
{"server-arg", 'A', "Send enbedded server this as a paramenter.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-file", 'F', "Read embedded server arguments from file",
{"server-file", 'F', "Read embedded server arguments from file.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Suppress all normal output. Synonym for --quiet.",
(gptr*) &silent, (gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
"Don't use the memory allocation checking", 0, 0, 0, GET_NO_ARG, NO_ARG,
"Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"sleep", 'T', "Sleep always this many seconds on sleep commands",
{"sleep", 'T', "Sleep always this many seconds on sleep commands.",
(gptr*) &opt_sleep, (gptr*) &opt_sleep, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
{"socket", 'S', "Socket file to use for connection.",
@ -1862,7 +1866,7 @@ static struct my_option my_long_options[] =
#include "sslopt-longopts.h"
{"test-file", 'x', "Read test from/in this file (default stdin).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't', "Temporary directory where sockets are put",
{"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},
@ -1873,7 +1877,6 @@ static struct my_option my_long_options[] =
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void print_version(void)
{
printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,MTEST_VERSION,
@ -2147,6 +2150,10 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
if (i == 0 && q->expected_errors == 1)
{
/* Only log error if there is one possible error */
dynstr_append_mem(ds,"ERROR ",6);
replace_dynstr_append_mem(ds, mysql_sqlstate(mysql),
strlen(mysql_sqlstate(mysql)));
dynstr_append_mem(ds,": ",2);
replace_dynstr_append_mem(ds,mysql_error(mysql),
strlen(mysql_error(mysql)));
dynstr_append_mem(ds,"\n",1);

View File

@ -92,6 +92,14 @@ public:
Ptr[str_length]=0;
return Ptr;
}
inline char *c_ptr_safe()
{
if (Ptr && str_length < Alloced_length)
Ptr[str_length]=0;
else
(void) realloc(str_length);
return Ptr;
}
void set(String &str,uint32 offset,uint32 arg_length)
{

View File

@ -359,7 +359,7 @@ then
# we will gets some problems when linking static programs.
# The following code is used to fix this problem.
if test "$CXX" = "gcc"
if test "$CXX" = "gcc" -o "$CXX" = "ccache gcc"
then
if $CXX -v 2>&1 | grep 'version 3' > /dev/null 2>&1
then
@ -1023,8 +1023,16 @@ case $SYSTEM_TYPE in
;;
*freebsd*)
echo "Adding fix for interrupted reads"
CFLAGS="$CFLAGS -DHAVE_BROKEN_REALPATH"
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000 -DHAVE_BROKEN_REALPATH"
OSVERSION=`sysctl -a | grep osreldate | awk '{ print $2 }'`
if test "$OSVERSION" -gt "480100" && \
test "$OSVERSION" -lt "500000" || \
test "$OSVERSION" -gt "500109"
then
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000"
else
CFLAGS="$CFLAGS -DHAVE_BROKEN_REALPATH"
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000 -DHAVE_BROKEN_REALPATH"
fi
;;
*netbsd*)
echo "Adding flag -Dunix"
@ -2168,8 +2176,8 @@ AC_ARG_WITH(libedit,
[ with_libedit=undefined ]
)
compile_readline= no
compile_libedit= no
compile_readline="no"
compile_libedit="no"
if [test "$with_libedit" = "yes"] && [test "$with_readline" = "yes"]
then
@ -2255,6 +2263,12 @@ AC_ARG_WITH(charset,
[default_charset="$withval"],
[default_charset="$DEFAULT_CHARSET"])
AC_ARG_WITH(collation,
[ --with-collation=COLLATION
Default collation],
[default_collation="$withval"],
[default_collation="default"])
AC_ARG_WITH(extra-charsets,
[ --with-extra-charsets=CHARSET[,CHARSET,...]
@ -2281,7 +2295,6 @@ else
CHARSETS="$CHARSETS $EXTRA_CHARSETS"
fi
for cs in $CHARSETS
do
case $cs in
@ -2404,11 +2417,169 @@ do
done
AC_SUBST(default_charset)
AC_DEFINE_UNQUOTED(DEFAULT_CHARSET_NAME,"$default_charset")
default_charset_collations=""
AC_MSG_RESULT([default: $default_charset; compiled in: $CHARSETS])
case $default_charset in
armscii8)
default_charset_default_collation="armscii8_general_ci"
default_charset_collations="armscii8_general_ci armscii_bin"
;;
ascii)
default_charset_default_collation="ascii_general_ci"
default_charset_collations="ascii_general_ci ascii_bin"
;;
big5)
default_charset_default_collation="big5_chinese_ci"
default_charset_collations="big5_chinese_ci big5_bin"
;;
cp1250)
default_charset_default_collation="cp1250_general_ci"
default_charset_collations="cp1250_general_ci cp1250_czech_ci cp1250_bin"
;;
cp1251)
default_charset_default_collation="cp1251_general_ci"
default_charset_collations="cp1251_general_ci cp1251_general_cs cp1251_bin cp1251_bulgarian_ci cp1251_ukrainian_ci"
;;
cp1256)
default_charset_default_collation="cp1256_general_ci"
default_charset_collations="cp1256_general_ci cp1256_bin"
;;
cp1257)
default_charset_default_collation="cp1257_general_ci"
default_charset_collations="cp1257_general_ci cp1257_lithuanian_ci cp1257_bin"
;;
cp850)
default_charset_default_collation="cp850_general_ci"
default_charset_collations="cp850_general_ci cp850_bin"
;;
cp852)
default_charset_default_collation="cp852_general_ci"
default_charset_collations="cp852_general_ci cp852_bin"
;;
cp866)
default_charset_default_collation="cp866_general_ci"
default_charset_collations="cp866_general_ci cp866_bin"
;;
dec8)
default_charset_default_collation="dec8_swedish_ci"
default_charset_collations="dec8_swedish_ci dec8_bin"
;;
euckr)
default_charset_default_collation="euckr_korean_ci"
default_charset_collations="euckr_korean_ci euckr_bin"
;;
gb2312)
default_charset_default_collation="gb2312_chinese_ci"
default_charset_collations="gb2312_chinese_ci gb2312_bin"
;;
gbk)
default_charset_default_collation="gbk_chinese_ci"
default_charset_collations="gbk_chinese_ci gbk_bin"
;;
greek)
default_charset_default_collation="greek_general_ci"
default_charset_collations="greek_general_ci greek_bin"
;;
hebrew)
default_charset_default_collation="hebrew_general_ci"
default_charset_collations="hebrew_general_ci hebrew_bin"
;;
hp8)
default_charset_default_collation="hp8_english_ci"
default_charset_collations="hp8_english_ci hp8_bin"
;;
keybcs2)
default_charset_default_collation="keybcs2_general_ci"
default_charset_collations="keybcs2_general_ci keybcs2_bin"
;;
koi8r)
default_charset_default_collation="koi8r_general_ci"
default_charset_collations="koi8r_general_ci koi8r_bin"
;;
koi8u)
default_charset_default_collation="koi8u_general_ci"
default_charset_collations="koi8u_general_ci koi8u_bin"
;;
latin1)
default_charset_default_collation="latin1_swedish_ci"
default_charset_collations="latin1_general_ci latin1_general_cs latin1_bin latin1_german1_ci latin1_german2_ci latin1_danish_ci latin1_swedish_ci"
;;
latin2)
default_charset_default_collation="latin2_general_ci"
default_charset_collations="latin2_general_ci latin2_bin latin2_czech_ci latin2_hungarian_ci latin2_croatian_ci"
;;
latin5)
default_charset_default_collation="latin5_turkish_ci"
default_charset_collations="latin5_turkish_ci latin5_bin"
;;
latin7)
default_charset_default_collation="latin7_general_ci"
default_charset_collations="latin7_general_ci latin7_general_cs latin7_bin latin7_estonian_cs"
;;
macce)
default_charset_default_collation="macce_general_ci"
default_charset_collations="macce_general_ci macce_bin"
;;
macroman)
default_charset_default_collation="macroman_general_ci"
default_charset_collations="macroman_general_ci macroman_bin"
;;
sjis)
default_charset_default_collation="sjis_japanese_ci"
default_charset_collations="sjis_japanese_ci sjis_bin"
;;
swe7)
default_charset_default_collation="swe7_swedish_ci"
default_charset_collations="swe7_swedish_ci swe7_bin"
;;
tis620)
default_charset_default_collation="tis620_thai_ci"
default_charset_collations="tis620_thai_ci tis620_bin"
;;
ucs2)
default_charset_default_collation="ucs2_general_ci"
default_charset_collations="ucs2_general_ci ucs2_bin"
;;
ujis)
default_charset_default_collation="ujis_japanese_ci"
default_charset_collations="ujis_japanese_ci ujis_bin"
;;
utf8)
default_charset_default_collation="utf8_general_ci"
default_charset_collations="utf8_general_ci utf8_bin"
;;
*)
AC_MSG_ERROR([Charset $cs not available. (Available are: $CHARSETS_AVAILABLE).
See the Installation chapter in the Reference Manual.]);
esac
if test "$default_collation" = default; then
default_collation=$default_charset_default_collation
fi
valid_default_collation=no
for cl in $default_charset_collations
do
if test x"$cl" = x"$default_collation"
then
valid_default_collation=yes
break
fi
done
if test x$valid_default_collation = xyes
then
AC_MSG_RESULT([default: $default_charset, collation: $default_collation; compiled in: $CHARSETS])
else
AC_MSG_ERROR([
Collation $default_collation is not valid for character set $default_charset.
Valid collations are: $default_charset_collations.
See the Installation chapter in the Reference Manual.
]);
fi
AC_DEFINE_UNQUOTED(MYSQL_DEFAULT_CHARSET_NAME,"$default_charset")
AC_DEFINE_UNQUOTED(MYSQL_DEFAULT_COLLATION_NAME,"$default_collation")
MYSQL_CHECK_ISAM
MYSQL_CHECK_BDB
@ -2649,6 +2820,7 @@ AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile dnl
libmysql_r/Makefile libmysqld/Makefile libmysqld/examples/Makefile dnl
libmysql/Makefile client/Makefile dnl
pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile dnl
sql-common/Makefile dnl
merge/Makefile dbug/Makefile scripts/Makefile dnl
include/Makefile sql-bench/Makefile tools/Makefile dnl
tests/Makefile Docs/Makefile support-files/Makefile dnl
@ -2669,6 +2841,7 @@ echo "Remember to check the platform specific part of the reference manual for"
echo "hints about installing MySQL on your platform. Also have a look at the"
echo "files in the Docs directory."
echo
# The following text is checked in ./Do-compile to se that the configure ends.
# The following text is checked in ./Do-compile to verify that configure
# ended sucessfully - don't remove it.
echo "Thank you for choosing MySQL!"
echo

View File

@ -280,7 +280,7 @@ static BOOLEAN Writable(char *pathname);
static void ChangeOwner(char *pathname);
/* Allocate memory for runtime support */
#endif
static char *DbugMalloc(int size);
static char *DbugMalloc(size_t size);
/* Remove leading pathname components */
static char *BaseName(const char *pathname);
static void DoPrefix(uint line);
@ -1120,7 +1120,7 @@ static void PushState ()
init_done=TRUE;
}
(void) code_state(); /* Alloc memory */
new_malloc = (struct state *) DbugMalloc (sizeof (struct state));
new_malloc = (struct state *) DbugMalloc(sizeof (struct state));
new_malloc -> flags = 0;
new_malloc -> delay = 0;
new_malloc -> maxdepth = MAXDEPTH;
@ -1341,11 +1341,10 @@ struct link *linkp)
*/
static char *StrDup (
const char *str)
static char *StrDup (const char *str)
{
reg1 char *new_malloc;
new_malloc = DbugMalloc ((int) strlen (str) + 1);
new_malloc = DbugMalloc((size_t) strlen (str) + 1);
(void) strcpy (new_malloc, str);
return (new_malloc);
}
@ -1606,14 +1605,13 @@ static void DbugExit (const char *why)
*
*/
static char *DbugMalloc (
int size)
static char *DbugMalloc (size_t size)
{
register char *new_malloc;
register char *new_malloc;
if (!(new_malloc = (char*) malloc ((unsigned int) size)))
DbugExit ("out of memory");
return (new_malloc);
if (!(new_malloc = (char*) malloc((size_t) size)))
DbugExit ("out of memory");
return (new_malloc);
}
@ -1622,9 +1620,7 @@ int size)
* separator (to allow directory-paths in dos).
*/
static char *static_strtok (
char *s1,
pchar separator)
static char *static_strtok (char *s1, pchar separator)
{
static char *end = NULL;
reg1 char *rtnval,*cpy;

View File

@ -29,10 +29,10 @@ const char *config_file="my"; /* Default config file */
static struct my_option my_long_options[] =
{
{"config-file", 'c', "The config file to be used",
{"config-file", 'c', "The config file to be used.",
(gptr*) &config_file, (gptr*) &config_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"defaults-file", 'c', "Synonym for --config-file",
{"defaults-file", 'c', "Synonym for --config-file.",
(gptr*) &config_file, (gptr*) &config_file, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"defaults-extra-file", 'e',
@ -40,10 +40,10 @@ static struct my_option my_long_options[] =
(gptr*) &defaults_extra_file, (gptr*) &defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extra-file", 'e',
"Synonym for --defaults-extra-file",
"Synonym for --defaults-extra-file.",
(gptr*) &defaults_extra_file, (gptr*) &defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"no-defaults", 'n', "Return an empty string (useful for scripts)",
{"no-defaults", 'n', "Return an empty string (useful for scripts).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help message and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -52,7 +52,6 @@ static struct my_option my_long_options[] =
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void usage(my_bool version)
{
printf("%s Ver 1.5 for %s at %s\n",my_progname,SYSTEM_TYPE,

View File

@ -30,14 +30,14 @@ static struct my_option my_long_options[] =
{
{"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"info", 'I', "Synonym for --help", 0, 0, 0, GET_NO_ARG,
{"info", 'I', "Synonym for --help.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_SYS_ERRLIST
{"all", 'a', "Print all the error messages and the number.",
(gptr*) &print_all_codes, (gptr*) &print_all_codes, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
#endif
{"silent", 's', "Only print the error message", 0, 0, 0, GET_NO_ARG, NO_ARG,
{"silent", 's', "Only print the error message.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Print error code and message (default).", (gptr*) &verbose,
(gptr*) &verbose, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},

View File

@ -43,7 +43,7 @@ static struct my_option my_long_options[] =
{
{"help", '?', "Displays this help and exits.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"info", 'I', "Synonym for --help",
{"info", 'I', "Synonym for --help.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Be more silent.", (gptr*) &silent, (gptr*) &silent,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},

View File

@ -38,7 +38,7 @@ int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
custom_arg.keyseg= info->s->keydef[inx].seg;
custom_arg.key_length= info->lastkey_len=
hp_rb_pack_key(keyinfo, (uchar*) info->recbuf,
hp_rb_pack_key(keyinfo, (uchar*) info->lastkey,
(uchar*) key, key_len);
custom_arg.search_flag= SEARCH_FIND | SEARCH_SAME;
/* for next rkey() after deletion */
@ -48,7 +48,7 @@ int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
info->last_find_flag= HA_READ_KEY_OR_PREV;
else
info->last_find_flag= find_flag;
if (!(pos= tree_search_key(&keyinfo->rb_tree, info->recbuf, info->parents,
if (!(pos= tree_search_key(&keyinfo->rb_tree, info->lastkey, info->parents,
&info->last_pos, find_flag, &custom_arg)))
{
info->update= 0;

View File

@ -21,7 +21,8 @@ pkginclude_HEADERS = my_dbug.h m_string.h my_sys.h my_list.h my_xml.h \
my_semaphore.h my_pthread.h my_no_pthread.h raid.h \
errmsg.h my_global.h my_net.h my_alloc.h \
my_getopt.h sslopt-longopts.h my_dir.h typelib.h \
sslopt-vars.h sslopt-case.h $(BUILT_SOURCES)
sslopt-vars.h sslopt-case.h sql_common.h \
sql_state.h $(BUILT_SOURCES)
noinst_HEADERS = config-win.h config-os2.h config-netware.h \
nisam.h heap.h merge.h my_bitmap.h\
myisam.h myisampack.h myisammrg.h ft_global.h\

View File

@ -138,6 +138,11 @@ typedef uint rf_SetTimer;
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_OFF_T 8
#ifdef _WIN64
#define SIZEOF_CHARP 8
#else
#define SIZEOF_CHARP 4
#endif
#define HAVE_BROKEN_NETINET_INCLUDES
#ifdef __NT__
#define HAVE_NAMED_PIPE /* We can only create pipes on NT */
@ -203,6 +208,7 @@ inline double ulonglong2double(ulonglong value)
/* Optimized store functions for Intel x86 */
#ifndef _WIN64
#define sint2korr(A) (*((int16 *) (A)))
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
(((uint32) 255L << 24) | \
@ -243,7 +249,7 @@ inline double ulonglong2double(ulonglong value)
#define float8get(V,M) doubleget((V),(M))
#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
#define float8store(V,M) doublestore((V),(M))
#endif /* _WIN64 */
#define HAVE_PERROR
#define HAVE_VFPRINT
@ -333,3 +339,5 @@ inline double ulonglong2double(ulonglong value)
#define shared_memory_buffer_length 16000
#define default_shared_memory_base_name "MYSQL"
#define MYSQL_DEFAULT_CHARSET_NAME "latin1"
#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"

View File

@ -62,9 +62,9 @@ typedef struct unicase_info_st
#define MY_CS_PRIMARY 32 /* if primary collation */
#define MY_CS_STRNXFRM 64 /* if strnxfrm is used for sort */
#define MY_CS_UNICODE 128 /* is a charset is full unicode */
#define MY_CS_NONTEXT 256 /* if a charset is not sprintf() compatible */
#define MY_CHARSET_UNDEFINED 0
#define MY_CHARSET_CURRENT (default_charset_info->number)
typedef struct my_uni_idx_st

View File

@ -74,14 +74,14 @@
/* Unixware 7 */
#if !defined(HAVE_BFILL)
# define bfill(A,B,C) memset((A),(C),(B))
# define bmove_allign(A,B,C) memcpy((A),(B),(C))
# define bmove_align(A,B,C) memcpy((A),(B),(C))
#endif
#if !defined(HAVE_BCMP)
# define bcopy(s, d, n) memcpy((d), (s), (n))
# define bcmp(A,B,C) memcmp((A),(B),(C))
# define bzero(A,B) memset((A),0,(B))
# define bmove_allign(A,B,C) memcpy((A),(B),(C))
# define bmove_align(A,B,C) memcpy((A),(B),(C))
#endif
#if defined(__cplusplus) && !defined(OS2)
@ -111,11 +111,11 @@ extern char NEAR _dig_vec[]; /* Declared in int2str() */
#endif
#ifdef MSDOS
#undef bmove_allign
#define bmove512(A,B,C) bmove_allign(A,B,C)
#undef bmove_align
#define bmove512(A,B,C) bmove_align(A,B,C)
#define my_itoa(A,B,C) itoa(A,B,C)
#define my_ltoa(A,B,C) ltoa(A,B,C)
extern void bmove_allign(gptr dst,const gptr src,uint len);
extern void bmove_align(gptr dst,const gptr src,uint len);
#endif
#if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512)

View File

@ -123,7 +123,8 @@ enum ha_extra_function {
HA_EXTRA_NO_IGNORE_DUP_KEY,
HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE, /* Cursor will not be used for update */
HA_EXTRA_PREPARE_FOR_DELETE,
HA_EXTRA_PREPARE_FOR_UPDATE /* Remove read cache if problems */
HA_EXTRA_PREPARE_FOR_UPDATE, /* Remove read cache if problems */
HA_EXTRA_PRELOAD_BUFFER_SIZE /* Set buffer size for preloading */
};
/* The following is parameter to ha_panic() */
@ -256,6 +257,7 @@ enum ha_base_keytype {
#define HA_ERR_CANNOT_ADD_FOREIGN 150 /* Cannot add a foreign key constr. */
#define HA_ERR_NO_REFERENCED_ROW 151 /* Cannot add a child row */
#define HA_ERR_ROW_IS_REFERENCED 152 /* Cannot delete a parent row */
#define HA_ERR_NON_UNIQUE_BLOCK_SIZE 153 /* Non unique key block size */
/* Other constants */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 MySQL AB
/* Copyright (C) 2000-2003 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
@ -266,7 +266,7 @@ C_MODE_END
# endif
#endif /* TIME_WITH_SYS_TIME */
#ifdef HAVE_UNISTD_H
#if defined(HAVE_OPENSSL) && !defined(__FreeBSD__) && !defined(NeXT)
#if defined(HAVE_OPENSSL) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__)
#define crypt unistd_crypt
#endif
#include <unistd.h>
@ -654,7 +654,13 @@ extern double my_atof(const char*);
Max size that must be added to a so that we know Size to make
adressable obj.
*/
#if SIZEOF_CHARP == 4
typedef long my_ptrdiff_t;
#else
typedef long long my_ptrdiff_t;
#endif
#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1))
#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
/* Size to make adressable obj. */
@ -731,6 +737,8 @@ typedef unsigned __int64 my_ulonglong;
typedef unsigned long long my_ulonglong;
#endif
/* typedef used for length of string; Should be unsigned! */
typedef ulong size_str;
#ifdef USE_RAID
/*
@ -869,7 +877,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */
*/
/* Optimized store functions for Intel x86 */
#ifdef __i386__
#if defined(__i386__) && !defined(_WIN64)
#define sint2korr(A) (*((int16 *) (A)))
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
(((uint32) 255L << 24) | \

View File

@ -643,6 +643,8 @@ extern int init_key_cache(ulong use_mem);
extern int resize_key_cache(ulong use_mem);
extern byte *key_cache_read(File file,my_off_t filepos,byte* buff,uint length,
uint block_length,int return_buffer);
extern int key_cache_insert(File file, my_off_t filepos,
byte *buff, uint length);
extern int key_cache_write(File file,my_off_t filepos,byte* buff,uint length,
uint block_length,int force_write);
extern int flush_key_blocks(int file, enum flush_type type);

View File

@ -410,6 +410,7 @@ my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, ulonglong key_map,
int mi_init_bulk_insert(MI_INFO *info, ulong cache_size, ha_rows rows);
void mi_flush_bulk_insert(MI_INFO *info, uint inx);
void mi_end_bulk_insert(MI_INFO *info);
int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves);
#ifdef __cplusplus
}

View File

@ -135,9 +135,9 @@ typedef struct st_mysql_data {
} MYSQL_DATA;
struct st_mysql_options {
unsigned int connect_timeout;
unsigned int connect_timeout, read_timeout, write_timeout;
unsigned int port, protocol;
unsigned long client_flag;
unsigned int port;
char *host,*user,*password,*unix_socket,*db;
struct st_dynamic_array *init_commands;
char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
@ -146,6 +146,7 @@ struct st_mysql_options {
char *ssl_ca; /* PEM CA file */
char *ssl_capath; /* PEM directory of CA-s? */
char *ssl_cipher; /* cipher to use */
char *shared_memory_base_name;
unsigned long max_allowed_packet;
my_bool use_ssl; /* if to use SSL or not */
my_bool compress,named_pipe;
@ -167,18 +168,15 @@ struct st_mysql_options {
#ifdef EMBEDDED_LIBRARY
my_bool separate_thread;
#endif
char *shared_memory_base_name;
unsigned int protocol;
};
enum mysql_option
{
MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND,
MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME,
MYSQL_OPT_LOCAL_INFILE, MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME
#ifdef EMBEDDED_LIBRARY
, MYSQL_OPT_USE_RESULT
#endif
MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE,
MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE,
MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT,
MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT
};
enum mysql_status
@ -188,8 +186,8 @@ enum mysql_status
enum mysql_protocol_type
{
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, MYSQL_PROTOCOL_PIPE,
MYSQL_PROTOCOL_MEMORY
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
};
/*
There are three types of queries - the ones that have to go to
@ -268,7 +266,9 @@ typedef struct st_mysql
my_bool free_me; /* If free in mysql_close */
my_ulonglong insert_id; /* id if insert on table with NEXTNR */
unsigned int last_errno;
char *last_error;
unsigned int server_status;
char *last_error; /* Used by embedded server */
char sqlstate[SQLSTATE_LENGTH+1]; /* Used by embedded server */
} MYSQL;
#endif
@ -296,6 +296,10 @@ typedef struct st_mysql_res {
#define MANAGER_CLIENT_ERR 450
#define MANAGER_INTERNAL_ERR 500
#ifndef MYSQL_SERVER
#define MYSQL_CLIENT
#endif
typedef struct st_mysql_manager
@ -562,6 +566,7 @@ unsigned long STDCALL mysql_param_count(MYSQL_STMT * stmt);
my_bool STDCALL mysql_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
my_bool STDCALL mysql_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt);
my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt);
unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt);
const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt);

View File

@ -25,7 +25,7 @@
#define HOSTNAME_LENGTH 60
#define USERNAME_LENGTH 16
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 6
#define SQLSTATE_LENGTH 5
#define LOCAL_HOST "localhost"
#define LOCAL_HOST_NAMEDPIPE "."
@ -110,6 +110,7 @@ enum enum_server_command
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_QUERIES 65536 /* Enable/disable multiquery support */
#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */
#define CLIENT_REMEMBER_OPTIONS (1L << 31)
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
@ -324,6 +325,7 @@ my_bool check_scramble(const char *, const char *message,
unsigned long *salt,my_bool old_ver);
char *get_tty_password(char *opt_message);
void hash_password(unsigned long *result, const char *password);
const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
/* Some other useful functions */

View File

@ -10,6 +10,7 @@
#else
#define PROTOCOL_VERSION @PROTOCOL_VERSION@
#define MYSQL_SERVER_VERSION "@VERSION@"
#define MYSQL_BASE_VERSION "mysqld-@MYSQL_BASE_VERSION@"
#ifndef MYSQL_SERVER_SUFFIX
#define MYSQL_SERVER_SUFFIX "@MYSQL_SERVER_SUFFIX@"
#endif
@ -20,8 +21,5 @@
#define MYSQL_CONFIG_NAME "my"
/* mysqld compile time options */
#ifndef MYSQL_CHARSET
#define MYSQL_CHARSET "@default_charset@"
#endif /* MYSQL_CHARSET */
#endif /* _CUSTOMCONFIG_ */
#endif /* _mysql_version_h */

View File

@ -282,4 +282,6 @@
#define ER_WARN_DATA_TRUNCATED 1263
#define ER_WARN_USING_OTHER_HANDLER 1264
#define ER_CANT_AGGREGATE_COLLATIONS 1265
#define ER_DROP_USER 1266
#define ER_REVOKE_GRANTS 1267
#define ER_ERROR_MESSAGES 266

46
include/sql_common.h Normal file
View File

@ -0,0 +1,46 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 */
extern const char *unknown_sqlstate;
extern const char *not_error_sqlstate;
#ifdef __cplusplus
extern "C" {
#endif
ulong STDCALL net_field_length(uchar **packet);
my_ulonglong net_field_length_ll(uchar **packet);
MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
my_bool default_value, uint server_capabilities);
my_bool advanced_command(MYSQL *mysql, enum enum_server_command command,
const char *header, ulong header_length,
const char *arg, ulong arg_length, my_bool skip_check);
void free_rows(MYSQL_DATA *cur);
MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields,
uint field_count);
my_bool mysql_autenticate(MYSQL *mysql, const char *passwd);
void fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count);
void free_old_query(MYSQL *mysql);
void end_server(MYSQL *mysql);
my_bool mysql_reconnect(MYSQL *mysql);
#ifdef __cplusplus
}
#endif
#define protocol_41(A) ((A)->server_capabilities & CLIENT_PROTOCOL_41)

161
include/sql_state.h Normal file
View File

@ -0,0 +1,161 @@
/* Copyright (C) 2000-2003 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 */
/*
This file includes a mapping from mysql_errno.h to sql_state (as used by
MyODBC) and jdbc_state.
It's suitable to include into a C struct for further processing
The first column is the mysqld server error (declared in mysqld_error.h),
the second column is the ODBC state (which the 4.1 server sends out by
default) and the last is the state used by the JDBC driver.
If the last column is "" then it means that the JDBC driver is using the
ODBC state
The errors in this file is sorted in the same order as in mysqld_error.h
to allow on to do binary searches for the sqlstate.
*/
ER_DUP_KEY, "23000", "",
ER_OUTOFMEMORY, "HY001", "S1001",
ER_OUT_OF_SORTMEMORY, "HY001", "S1001",
ER_CON_COUNT_ERROR, "08004", "",
ER_BAD_HOST_ERROR, "08S01", "",
ER_HANDSHAKE_ERROR, "08S01", "",
ER_DBACCESS_DENIED_ERROR, "42000", "",
ER_ACCESS_DENIED_ERROR, "42000", "28000",
ER_NO_DB_ERROR, "42000", "",
ER_UNKNOWN_COM_ERROR, "08S01", "",
ER_BAD_NULL_ERROR, "23000", "",
ER_BAD_DB_ERROR, "42000", "",
ER_TABLE_EXISTS_ERROR, "42S01", "",
ER_BAD_TABLE_ERROR, "42S02", "",
ER_NON_UNIQ_ERROR, "23000", "",
ER_SERVER_SHUTDOWN, "08S01", "",
ER_BAD_FIELD_ERROR, "42S22", "S0022",
ER_WRONG_FIELD_WITH_GROUP, "42000", "S1009",
ER_WRONG_GROUP_FIELD, "42000", "S1009",
ER_WRONG_SUM_SELECT, "42000", "S1009",
ER_WRONG_VALUE_COUNT, "21S01", "",
ER_TOO_LONG_IDENT, "42000", "S1009",
ER_DUP_FIELDNAME, "42S21", "S1009",
ER_DUP_KEYNAME, "42000", "S1009",
ER_DUP_ENTRY, "23000", "S1009",
ER_WRONG_FIELD_SPEC, "42000", "S1009",
ER_PARSE_ERROR, "42000", "",
ER_EMPTY_QUERY, "42000" , "",
ER_NONUNIQ_TABLE, "42000", "S1009",
ER_INVALID_DEFAULT, "42000", "S1009",
ER_MULTIPLE_PRI_KEY, "42000", "S1009",
ER_TOO_MANY_KEYS, "42000", "S1009",
ER_TOO_MANY_KEY_PARTS, "42000", "S1009",
ER_TOO_LONG_KEY, "42000", "S1009",
ER_KEY_COLUMN_DOES_NOT_EXITS, "42000", "S1009",
ER_BLOB_USED_AS_KEY, "42000", "S1009",
ER_TOO_BIG_FIELDLENGTH, "42000", "S1009",
ER_WRONG_AUTO_KEY, "42000", "S1009",
ER_FORCING_CLOSE, "08S01", "",
ER_IPSOCK_ERROR, "088S01", "",
ER_NO_SUCH_INDEX, "42S12", "S1009",
ER_WRONG_FIELD_TERMINATORS, "42000", "S1009",
ER_BLOBS_AND_NO_TERMINATED, "42000", "S1009",
ER_CANT_REMOVE_ALL_FIELDS, "42000", "",
ER_CANT_DROP_FIELD_OR_KEY, "42000", "",
ER_BLOB_CANT_HAVE_DEFAULT, "42000", "",
ER_WRONG_DB_NAME, "42000", "",
ER_WRONG_TABLE_NAME, "42000", "",
ER_TOO_BIG_SELECT, "42000", "",
ER_UNKNOWN_PROCEDURE, "42000", "",
ER_WRONG_PARAMCOUNT_TO_PROCEDURE, "42000", "",
ER_UNKNOWN_TABLE, "42S02", "",
ER_FIELD_SPECIFIED_TWICE, "42000", "",
ER_UNSUPPORTED_EXTENSION, "42000", "",
ER_TABLE_MUST_HAVE_COLUMNS, "42000", "",
ER_UNKNOWN_CHARACTER_SET, "42000", "",
ER_TOO_BIG_ROWSIZE, "42000", "",
ER_WRONG_OUTER_JOIN, "42000", "",
ER_NULL_COLUMN_IN_INDEX, "42000", "",
ER_PASSWORD_ANONYMOUS_USER, "42000", "",
ER_PASSWORD_NOT_ALLOWED, "42000", "",
ER_PASSWORD_NO_MATCH, "42000", "",
ER_WRONG_VALUE_COUNT_ON_ROW, "21S01", "",
ER_INVALID_USE_OF_NULL, "42000", "",
ER_REGEXP_ERROR, "42000", "",
ER_MIX_OF_GROUP_FUNC_AND_FIELDS,"42000", "",
ER_NONEXISTING_GRANT, "42000", "",
ER_TABLEACCESS_DENIED_ERROR, "42000", "",
ER_COLUMNACCESS_DENIED_ERROR, "42000", "",
ER_ILLEGAL_GRANT_FOR_TABLE, "42000", "",
ER_GRANT_WRONG_HOST_OR_USER, "42000", "",
ER_NO_SUCH_TABLE, "42S02", "",
ER_NONEXISTING_TABLE_GRANT, "42000", "",
ER_NOT_ALLOWED_COMMAND, "42000", "",
ER_SYNTAX_ERROR, "42000", "",
ER_ABORTING_CONNECTION, "08S01", "",
ER_NET_PACKET_TOO_LARGE, "08S01", "",
ER_NET_READ_ERROR_FROM_PIPE, "08S01", "",
ER_NET_FCNTL_ERROR, "08S01", "",
ER_NET_PACKETS_OUT_OF_ORDER, "08S01", "",
ER_NET_UNCOMPRESS_ERROR, "08S01", "",
ER_NET_READ_ERROR, "08S01", "",
ER_NET_READ_INTERRUPTED, "08S01", "",
ER_NET_ERROR_ON_WRITE, "08S01", "",
ER_NET_WRITE_INTERRUPTED, "08S01", "",
ER_TOO_LONG_STRING, "42000", "",
ER_TABLE_CANT_HANDLE_BLOB, "42000", "",
ER_TABLE_CANT_HANDLE_AUTO_INCREMENT, "42000", "",
ER_WRONG_COLUMN_NAME, "42000", "",
ER_WRONG_KEY_COLUMN, "42000", "",
ER_DUP_UNIQUE, "23000", "",
ER_BLOB_KEY_WITHOUT_LENGTH, "42000", "",
ER_PRIMARY_CANT_HAVE_NULL, "42000", "",
ER_TOO_MANY_ROWS, "42000", "",
ER_REQUIRES_PRIMARY_KEY, "42000", "",
ER_CHECK_NO_SUCH_TABLE, "42000", "",
ER_CHECK_NOT_IMPLEMENTED, "42000", "",
ER_CANT_DO_THIS_DURING_AN_TRANSACTION, "25000", "",
ER_NEW_ABORTING_CONNECTION, "08S01", "",
ER_MASTER_NET_READ, "08S01", "",
ER_MASTER_NET_WRITE, "08S01", "",
ER_TOO_MANY_USER_CONNECTIONS, "42000", "",
ER_READ_ONLY_TRANSACTION, "25000", "",
ER_NO_PERMISSION_TO_CREATE_USER,"42000", "",
ER_LOCK_DEADLOCK, "40001", "",
ER_NO_REFERENCED_ROW, "23000", "",
ER_ROW_IS_REFERENCED, "23000", "",
ER_CONNECT_TO_MASTER, "08S01", "",
ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,"21000", "",
ER_USER_LIMIT_REACHED, "42000", "",
ER_NO_DEFAULT, "42000", "",
ER_WRONG_VALUE_FOR_VAR, "42000", "",
ER_WRONG_TYPE_FOR_VAR, "42000", "",
ER_CANT_USE_OPTION_HERE, "42000", "",
ER_NOT_SUPPORTED_YET, "42000", "",
ER_WRONG_FK_DEF, "42000", "",
ER_CARDINALITY_COL, "21000", "",
ER_SUBSELECT_NO_1_ROW, "21000", "",
ER_ILLEGAL_REFERENCE, "42S22", "",
ER_DERIVED_MUST_HAVE_ALIAS, "42000", "",
ER_SELECT_REDUCED, "01000", "",
ER_TABLENAME_NOT_ALLOWED_HERE, "42000", "",
ER_NOT_SUPPORTED_AUTH_MODE, "08004", "",
ER_SPATIAL_CANT_HAVE_NULL, "42000", "",
ER_COLLATION_CHARSET_MISMATCH, "42000", "",
ER_WARN_TOO_FEW_RECORDS, "01000", "",
ER_WARN_TOO_MANY_RECORDS, "01000", "",
ER_WARN_NULL_TO_NOTNULL, "01000", "",
ER_WARN_DATA_OUT_OF_RANGE, "01000", "",
ER_WARN_DATA_TRUNCATED, "01000", "",

View File

@ -17,24 +17,24 @@
#ifdef HAVE_OPENSSL
{"ssl", OPT_SSL_SSL,
"Enable SSL for connection (automatically enabled with other flags). Disable with --skip-ssl",
"Enable SSL for connection (automatically enabled with other flags). Disable with --skip-ssl.",
(gptr*) &opt_use_ssl, (gptr*) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl)",
{"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).",
(gptr*) &opt_ssl_key, (gptr*) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl)",
{"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl).",
(gptr*) &opt_ssl_cert, (gptr*) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-ca", OPT_SSL_CA,
"CA file in PEM format (check OpenSSL docs, implies --ssl)",
"CA file in PEM format (check OpenSSL docs, implies --ssl).",
(gptr*) &opt_ssl_ca, (gptr*) &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-capath", OPT_SSL_CAPATH,
"CA directory (check OpenSSL docs, implies --ssl)",
"CA directory (check OpenSSL docs, implies --ssl).",
(gptr*) &opt_ssl_capath, (gptr*) &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use (implies --ssl)",
{"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use (implies --ssl).",
(gptr*) &opt_ssl_cipher, (gptr*) &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},

View File

@ -103,7 +103,7 @@ void init_thr_alarm(uint max_alarm);
bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
void thr_alarm_kill(pthread_t thread_id);
void thr_end_alarm(thr_alarm_t *alarmed);
void end_thr_alarm(void);
void end_thr_alarm(my_bool free_structures);
sig_handler process_alarm(int);
#ifndef thr_got_alarm
bool thr_got_alarm(thr_alarm_t *alrm);

View File

@ -103,7 +103,8 @@ struct com_shm_endpoint_struct{
the area currently may contain a datagram;
NOTE: automatic event */
os_event_t empty; /* this is in the signaled state if the area
currently may be empty; NOTE: automatic event */
currently may be empty; NOTE: automatic
event */
ip_mutex_hdl_t* ip_mutex; /* handle to the interprocess mutex
protecting the shared memory */
UT_LIST_NODE_T(com_shm_endpoint_t) list; /* If the endpoint struct
@ -793,16 +794,18 @@ com_shm_create_or_open(
ut_strcpy(buf + len, (char*)"_IBSHM_EV_NE"),
event_ne = os_event_create_auto(buf);
event_ne = os_event_create(buf);
ut_ad(event_ne);
ut_strcpy(buf + len, (char*)"_IBSHM_EV_EM"),
event_em = os_event_create_auto(buf);
event_em = os_event_create(buf);
ut_ad(event_em);
ut_a(0); /* event_ne and event_em should be auto events! */
com_shm_endpoint_set_shm(ep, shm);
com_shm_endpoint_set_map(ep, map);

View File

@ -301,6 +301,13 @@ os_aio(
are ignored */
void* message2);
/****************************************************************************
Wakes up all async i/o threads so that they know to exit themselves in
shutdown. */
void
os_aio_wake_all_threads_at_shutdown(void);
/*=====================================*/
/****************************************************************************
Waits until there are no pending writes in os_aio_write_array. There can
be other, synchronous, pending writes. */

View File

@ -10,15 +10,29 @@ Created 9/6/1995 Heikki Tuuri
#define os0sync_h
#include "univ.i"
#include "ut0lst.h"
#ifdef __WIN__
#define os_fast_mutex_t CRITICAL_SECTION
typedef void* os_event_t;
typedef HANDLE os_native_event_t;
typedef struct os_event_struct os_event_struct_t;
typedef os_event_struct_t* os_event_t;
struct os_event_struct {
os_native_event_t handle;
/* Windows event */
UT_LIST_NODE_T(os_event_struct_t) os_event_list;
/* list of all created events */
};
#else
typedef pthread_mutex_t os_fast_mutex_t;
typedef struct os_event_struct os_event_struct_t;
typedef os_event_struct_t* os_event_t;
struct os_event_struct {
os_fast_mutex_t os_mutex; /* this mutex protects the next
fields */
@ -26,9 +40,9 @@ struct os_event_struct {
not reserved */
pthread_cond_t cond_var; /* condition variable is used in
waiting for the event */
UT_LIST_NODE_T(os_event_struct_t) os_event_list;
/* list of all created events */
};
typedef struct os_event_struct os_event_struct_t;
typedef os_event_struct_t* os_event_t;
#endif
typedef struct os_mutex_struct os_mutex_str_t;
@ -38,10 +52,32 @@ typedef os_mutex_str_t* os_mutex_t;
#define OS_SYNC_TIME_EXCEEDED 1
/* Mutex protecting counts and the event and OS 'slow' mutex lists */
extern os_mutex_t os_sync_mutex;
/* This is incremented by 1 in os_thread_create and decremented by 1 in
os_thread_exit */
extern ulint os_thread_count;
extern ulint os_event_count;
extern ulint os_mutex_count;
extern ulint os_fast_mutex_count;
/*************************************************************
Creates an event semaphore, i.e., a semaphore which may
just have two states: signaled and nonsignaled.
The created event is manual reset: it must be reset
Initializes global event and OS 'slow' mutex lists. */
void
os_sync_init(void);
/*==============*/
/*************************************************************
Frees created events and OS 'slow' mutexes. */
void
os_sync_free(void);
/*==============*/
/*************************************************************
Creates an event semaphore, i.e., a semaphore which may just have two states:
signaled and nonsignaled. The created event is manual reset: it must be reset
explicitly by calling sync_os_reset_event. */
os_event_t
@ -50,10 +86,10 @@ os_event_create(
/* out: the event handle */
char* name); /* in: the name of the event, if NULL
the event is created without a name */
#ifdef __WIN__
/*************************************************************
Creates an auto-reset event semaphore, i.e., an event
which is automatically reset when a single thread is
released. */
Creates an auto-reset event semaphore, i.e., an event which is automatically
reset when a single thread is released. Works only in Windows. */
os_event_t
os_event_create_auto(
@ -61,6 +97,7 @@ os_event_create_auto(
/* out: the event handle */
char* name); /* in: the name of the event, if NULL
the event is created without a name */
#endif
/**************************************************************
Sets an event semaphore to the signaled state: lets waiting threads
proceed. */
@ -85,7 +122,10 @@ os_event_free(
/*==========*/
os_event_t event); /* in: event to free */
/**************************************************************
Waits for an event object until it is in the signaled state. */
Waits for an event object until it is in the signaled state. If
srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS this also exits the
waiting thread when the event becomes signaled (or immediately if the
event is already in the signaled state). */
void
os_event_wait(
@ -93,7 +133,7 @@ os_event_wait(
os_event_t event); /* in: event to wait */
/**************************************************************
Waits for an event object until it is in the signaled state or
a timeout is exceeded. */
a timeout is exceeded. In Unix the timeout is always infinite. */
ulint
os_event_wait_time(
@ -104,8 +144,9 @@ os_event_wait_time(
os_event_t event, /* in: event to wait */
ulint time); /* in: timeout in microseconds, or
OS_SYNC_INFINITE_TIME */
#ifdef __WIN__
/**************************************************************
Waits for any event in an event array. Returns if even a single
Waits for any event in an OS native event array. Returns if even a single
one is signaled or becomes signaled. */
ulint
@ -113,14 +154,15 @@ os_event_wait_multiple(
/*===================*/
/* out: index of the event
which was signaled */
ulint n, /* in: number of events in the
ulint n, /* in: number of events in the
array */
os_event_t* event_array); /* in: pointer to an array of event
os_native_event_t* native_event_array);
/* in: pointer to an array of event
handles */
#endif
/*************************************************************
Creates an operating system mutex semaphore.
Because these are slow, the mutex semaphore of the database
itself (sync_mutex_t) should be used where possible. */
Creates an operating system mutex semaphore. Because these are slow, the
mutex semaphore of InnoDB itself (mutex_t) should be used where possible. */
os_mutex_t
os_mutex_create(

View File

@ -44,4 +44,3 @@ os_fast_mutex_trylock(
#endif
#endif
}

View File

@ -41,7 +41,6 @@ typedef os_thread_t os_thread_id_t; /* In Unix we use the thread
the thread */
#endif
/* Define a function pointer type to use in a typecast */
typedef void* (*os_posix_f_t) (void*);
@ -66,7 +65,9 @@ os_thread_pf(
/********************************************************************
Creates a new thread of execution. The execution starts from
the function given. The start function takes a void* parameter
and returns a ulint. */
and returns a ulint.
NOTE: We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
os_thread_t
os_thread_create(
@ -83,12 +84,13 @@ os_thread_create(
os_thread_id_t* thread_id); /* out: id of the created
thread */
/*********************************************************************
A thread calling this function ends its execution. */
Exits the current thread. */
void
os_thread_exit(
/*===========*/
ulint code); /* in: exit code */
void* exit_value); /* in: exit value; in Windows this void*
is cast as a DWORD */
/*********************************************************************
Returns the thread identifier of current thread. */
@ -144,7 +146,6 @@ ulint
os_thread_get_last_error(void);
/*==========================*/
#ifndef UNIV_NONINL
#include "os0thread.ic"
#endif

View File

@ -212,6 +212,12 @@ void
srv_init(void);
/*==========*/
/*************************************************************************
Frees the OS fast mutex created in srv_init(). */
void
srv_free(void);
/*==========*/
/*************************************************************************
Initializes the synchronization primitives, memory system, and the thread
local storage. */

View File

@ -86,11 +86,12 @@ extern ibool srv_startup_is_before_trx_rollback_phase;
extern ibool srv_is_being_shut_down;
/* At a shutdown the value first climbs from 0 to SRV_SHUTDOWN_CLEANUP
and then to SRV_SHUTDOWN_LAST_PHASE */
and then to SRV_SHUTDOWN_LAST_PHASE, and so on */
extern ulint srv_shutdown_state;
#define SRV_SHUTDOWN_CLEANUP 1
#define SRV_SHUTDOWN_LAST_PHASE 2
#define SRV_SHUTDOWN_CLEANUP 1
#define SRV_SHUTDOWN_LAST_PHASE 2
#define SRV_SHUTDOWN_EXIT_THREADS 3
#endif

View File

@ -187,7 +187,11 @@ management to ensure correct alignment for doubles etc. */
/* Another basic type we use is unsigned long integer which is intended to be
equal to the word size of the machine. */
#ifdef _WIN64
typedef unsigned __int64 ulint;
#else
typedef unsigned long int ulint;
#endif
typedef long int lint;

View File

@ -375,7 +375,7 @@ log_pad_current_log_block(void)
log_close();
log_release();
ut_a((ut_dulint_get_low(lsn) % OS_FILE_LOG_BLOCK_SIZE)
ut_ad((ut_dulint_get_low(lsn) % OS_FILE_LOG_BLOCK_SIZE)
== LOG_BLOCK_HDR_SIZE);
}
@ -999,6 +999,8 @@ log_group_file_header_flush(
byte* buf;
ulint dest_offset;
UT_NOT_USED(type);
ut_ad(mutex_own(&(log_sys->mutex)));
ut_a(nth_file < group->n_files);
@ -1068,8 +1070,8 @@ log_group_write_buf(
ulint i;
ut_ad(mutex_own(&(log_sys->mutex)));
ut_a(len % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
if (new_data_offset == 0) {
write_header = TRUE;
@ -2901,10 +2903,9 @@ logs_empty_and_mark_files_at_shutdown(void)
dulint lsn;
ulint arch_log_no;
if (srv_print_verbose_log)
{
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Starting shutdown...\n");
if (srv_print_verbose_log) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Starting shutdown...\n");
}
/* Wait until the master thread and all other operations are idle: our
algorithm only works if the server is idle at shutdown */
@ -3006,15 +3007,17 @@ loop:
goto loop;
}
/* Make some checks that the server really is quiet */
ut_a(buf_all_freed());
ut_a(0 == ut_dulint_cmp(lsn, log_sys->lsn));
fil_write_flushed_lsn_to_data_files(lsn, arch_log_no);
fil_flush_file_spaces(FIL_TABLESPACE);
if (srv_print_verbose_log)
{
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Shutdown completed\n");
}
/* Make some checks that the server really is quiet */
ut_a(buf_all_freed());
ut_a(0 == ut_dulint_cmp(lsn, log_sys->lsn));
}
/**********************************************************

View File

@ -80,6 +80,8 @@ struct os_aio_slot_struct{
which pending aio operation was
completed */
#ifdef WIN_ASYNC_IO
os_event_t event; /* event object we need in the
OVERLAPPED struct */
OVERLAPPED control; /* Windows control block for the
aio request */
#elif defined(POSIX_ASYNC_IO)
@ -107,11 +109,14 @@ struct os_aio_array_struct{
ulint n_reserved;/* Number of reserved slots in the
aio array outside the ibuf segment */
os_aio_slot_t* slots; /* Pointer to the slots in the array */
os_event_t* events; /* Pointer to an array of event handles
where we copied the handles from slots,
in the same order. This can be used in
WaitForMultipleObjects; used only in
#ifdef __WIN__
os_native_event_t* native_events;
/* Pointer to an array of OS native event
handles where we copied the handles from
slots, in the same order. This can be used
in WaitForMultipleObjects; used only in
Windows */
#endif
};
/* Array of events used in simulated aio */
@ -295,7 +300,8 @@ os_file_handle_error(
/* out: TRUE if we should retry the
operation */
os_file_t file, /* in: file pointer */
char* name) /* in: name of a file or NULL */
char* name, /* in: name of a file or NULL */
const char* operation)/* in: operation */
{
ulint err;
@ -338,6 +344,7 @@ os_file_handle_error(
fprintf(stderr, "InnoDB: File name %s\n", name);
}
fprintf(stderr, "InnoDB: System call %s.\n", operation);
fprintf(stderr, "InnoDB: Cannot continue operation.\n");
fflush(stderr);
@ -419,8 +426,9 @@ try_again:
if (file == INVALID_HANDLE_VALUE) {
*success = FALSE;
retry = os_file_handle_error(file, name);
retry = os_file_handle_error(file, name,
create_mode == OS_FILE_OPEN ?
"open" : "create");
if (retry) {
goto try_again;
}
@ -460,8 +468,9 @@ try_again:
if (file == -1) {
*success = FALSE;
retry = os_file_handle_error(file, name);
retry = os_file_handle_error(file, name,
create_mode == OS_FILE_OPEN ?
"open" : "create");
if (retry) {
goto try_again;
}
@ -568,8 +577,9 @@ try_again:
if (file == INVALID_HANDLE_VALUE) {
*success = FALSE;
retry = os_file_handle_error(file, name);
retry = os_file_handle_error(file, name,
create_mode == OS_FILE_OPEN ?
"open" : "create");
if (retry) {
goto try_again;
}
@ -615,8 +625,9 @@ try_again:
if (file == -1) {
*success = FALSE;
retry = os_file_handle_error(file, name);
retry = os_file_handle_error(file, name,
create_mode == OS_FILE_OPEN ?
"open" : "create");
if (retry) {
goto try_again;
}
@ -649,7 +660,7 @@ os_file_close(
return(TRUE);
}
os_file_handle_error(file, NULL);
os_file_handle_error(file, NULL, "close");
return(FALSE);
#else
int ret;
@ -657,7 +668,7 @@ os_file_close(
ret = close(file);
if (ret == -1) {
os_file_handle_error(file, NULL);
os_file_handle_error(file, NULL, "close");
return(FALSE);
}
@ -825,7 +836,7 @@ os_file_flush(
return(TRUE);
}
os_file_handle_error(file, NULL);
os_file_handle_error(file, NULL, "flush");
/* It is a fatal error if a file flush does not succeed, because then
the database can get corrupt on disk */
@ -858,7 +869,7 @@ os_file_flush(
fprintf(stderr,
" InnoDB: Error: the OS said file flush did not succeed\n");
os_file_handle_error(file, NULL);
os_file_handle_error(file, NULL, "flush");
/* It is a fatal error if a file flush does not succeed, because then
the database can get corrupt on disk */
@ -1099,7 +1110,7 @@ try_again:
#ifdef __WIN__
error_handling:
#endif
retry = os_file_handle_error(file, NULL);
retry = os_file_handle_error(file, NULL, "read");
if (retry) {
goto try_again;
@ -1295,7 +1306,6 @@ os_aio_array_create(
#endif
ut_a(n > 0);
ut_a(n_segments > 0);
ut_a(n % n_segments == 0);
array = ut_malloc(sizeof(os_aio_array_t));
@ -1309,19 +1319,22 @@ os_aio_array_create(
array->n_segments = n_segments;
array->n_reserved = 0;
array->slots = ut_malloc(n * sizeof(os_aio_slot_t));
array->events = ut_malloc(n * sizeof(os_event_t));
#ifdef __WIN__
array->native_events = ut_malloc(n * sizeof(os_native_event_t));
#endif
for (i = 0; i < n; i++) {
slot = os_aio_array_get_nth_slot(array, i);
slot->pos = i;
slot->reserved = FALSE;
#ifdef WIN_ASYNC_IO
slot->event = os_event_create(NULL);
over = &(slot->control);
over->hEvent = os_event_create(NULL);
over->hEvent = slot->event->handle;
*((array->events) + i) = over->hEvent;
*((array->native_events) + i) = over->hEvent;
#endif
}
@ -1405,6 +1418,50 @@ os_aio_init(
#endif
}
#ifdef WIN_ASYNC_IO
/****************************************************************************
Wakes up all async i/o threads in the array in Windows async i/o at
shutdown. */
static
void
os_aio_array_wake_win_aio_at_shutdown(
/*==================================*/
os_aio_array_t* array) /* in: aio array */
{
ulint i;
for (i = 0; i < array->n_slots; i++) {
os_event_set((array->slots + i)->event);
}
}
#endif
/****************************************************************************
Wakes up all async i/o threads so that they know to exit themselves in
shutdown. */
void
os_aio_wake_all_threads_at_shutdown(void)
/*=====================================*/
{
ulint i;
#ifdef WIN_ASYNC_IO
/* This code wakes up all ai/o threads in Windows native aio */
os_aio_array_wake_win_aio_at_shutdown(os_aio_read_array);
os_aio_array_wake_win_aio_at_shutdown(os_aio_write_array);
os_aio_array_wake_win_aio_at_shutdown(os_aio_ibuf_array);
os_aio_array_wake_win_aio_at_shutdown(os_aio_log_array);
#endif
/* This loop wakes up all simulated ai/o threads */
for (i = 0; i < os_aio_n_segments; i++) {
os_event_set(os_aio_segment_wait_events[i]);
}
}
/****************************************************************************
Waits until there are no pending writes in os_aio_write_array. There can
be other, synchronous, pending writes. */
@ -1635,7 +1692,7 @@ loop:
control = &(slot->control);
control->Offset = (DWORD)offset;
control->OffsetHigh = (DWORD)offset_high;
os_event_reset(control->hEvent);
os_event_reset(slot->event);
#elif defined(POSIX_ASYNC_IO)
@ -1693,7 +1750,7 @@ os_aio_array_free_slot(
}
#ifdef WIN_ASYNC_IO
os_event_reset(slot->control.hEvent);
os_event_reset(slot->event);
#endif
os_mutex_exit(array->mutex);
}
@ -1862,7 +1919,8 @@ os_aio(
wait in the Windows case. */
if (type == OS_FILE_READ) {
return(os_file_read(file, buf, offset, offset_high, n));
return(os_file_read(file, buf, offset,
offset_high, n));
}
ut_a(type == OS_FILE_WRITE);
@ -1940,8 +1998,7 @@ try_again:
#ifdef WIN_ASYNC_IO
if (os_aio_use_native_aio) {
if ((ret && len == n)
|| (!ret && GetLastError() == ERROR_IO_PENDING)) {
|| (!ret && GetLastError() == ERROR_IO_PENDING)) {
/* aio was queued successfully! */
if (mode == OS_AIO_SYNC) {
@ -1971,8 +2028,8 @@ try_again:
os_aio_array_free_slot(array, slot);
retry = os_file_handle_error(file, name);
retry = os_file_handle_error(file, name,
type == OS_FILE_READ ? "aio read" : "aio write");
if (retry) {
goto try_again;
@ -2037,15 +2094,15 @@ os_aio_windows_handle(
n = array->n_slots / array->n_segments;
if (array == os_aio_sync_array) {
srv_io_thread_op_info[orig_seg] = "wait Windows aio for 1 page";
ut_ad(pos < array->n_slots);
os_event_wait(array->events[pos]);
srv_io_thread_op_info[orig_seg] =
"wait Windows aio for 1 page";
os_event_wait(os_aio_array_get_nth_slot(array, pos)->event);
i = pos;
} else {
srv_io_thread_op_info[orig_seg] =
"wait Windows aio";
i = os_event_wait_multiple(n, (array->events) + segment * n);
i = os_event_wait_multiple(n,
(array->native_events) + segment * n);
}
os_mutex_enter(array->mutex);
@ -2070,7 +2127,7 @@ os_aio_windows_handle(
ut_a(TRUE == os_file_flush(slot->file));
}
} else {
os_file_handle_error(slot->file, slot->name);
os_file_handle_error(slot->file, slot->name, "Windows aio");
ret_val = FALSE;
}

View File

@ -17,6 +17,7 @@ Created 9/6/1995 Heikki Tuuri
#endif
#include "ut0mem.h"
#include "srv0start.h"
/* Type definition for an operating system mutex struct */
struct os_mutex_struct{
@ -27,13 +28,83 @@ struct os_mutex_struct{
do not assume that the OS mutex
supports recursive locking, though
NT seems to do that */
UT_LIST_NODE_T(os_mutex_str_t) os_mutex_list;
/* list of all 'slow' OS mutexes created */
};
/* Mutex protecting counts and the lists of OS mutexes and events */
os_mutex_t os_sync_mutex;
ibool os_sync_mutex_inited = FALSE;
/* This is incremented by 1 in os_thread_create and decremented by 1 in
os_thread_exit */
ulint os_thread_count = 0;
/* The list of all events created */
UT_LIST_BASE_NODE_T(os_event_struct_t) os_event_list;
/* The list of all OS 'slow' mutexes */
UT_LIST_BASE_NODE_T(os_mutex_str_t) os_mutex_list;
ulint os_event_count = 0;
ulint os_mutex_count = 0;
ulint os_fast_mutex_count = 0;
/*************************************************************
Creates an event semaphore, i.e., a semaphore which may
just have two states: signaled and nonsignaled.
The created event is manual reset: it must be reset
explicitly by calling sync_os_reset_event. */
Initializes global event and OS 'slow' mutex lists. */
void
os_sync_init(void)
/*==============*/
{
UT_LIST_INIT(os_event_list);
UT_LIST_INIT(os_mutex_list);
os_sync_mutex = os_mutex_create(NULL);
os_sync_mutex_inited = TRUE;
}
/*************************************************************
Frees created events and OS 'slow' mutexes. */
void
os_sync_free(void)
/*==============*/
{
os_event_t event;
os_mutex_t mutex;
event = UT_LIST_GET_FIRST(os_event_list);
while (event) {
os_event_free(event);
event = UT_LIST_GET_FIRST(os_event_list);
}
mutex = UT_LIST_GET_FIRST(os_mutex_list);
while (mutex) {
if (mutex == os_sync_mutex) {
/* Set the flag to FALSE so that we do not try to
reserve os_sync_mutex any more in remaining freeing
operations in shutdown */
os_sync_mutex_inited = FALSE;
}
os_mutex_free(mutex);
mutex = UT_LIST_GET_FIRST(os_mutex_list);
}
}
/*************************************************************
Creates an event semaphore, i.e., a semaphore which may just have two
states: signaled and nonsignaled. The created event is manual reset: it
must be reset explicitly by calling sync_os_reset_event. */
os_event_t
os_event_create(
@ -43,22 +114,20 @@ os_event_create(
the event is created without a name */
{
#ifdef __WIN__
HANDLE event;
os_event_t event;
event = CreateEvent(NULL, /* No security attributes */
event = ut_malloc(sizeof(struct os_event_struct));
event->handle = CreateEvent(NULL,/* No security attributes */
TRUE, /* Manual reset */
FALSE, /* Initial state nonsignaled */
name);
if (!event) {
if (!event->handle) {
fprintf(stderr,
"InnoDB: Could not create a Windows event semaphore; Windows error %lu\n",
(ulint)GetLastError());
}
ut_a(event);
return(event);
#else
#else /* Unix */
os_event_t event;
UT_NOT_USED(name);
@ -74,15 +143,24 @@ os_event_create(
ut_a(0 == pthread_cond_init(&(event->cond_var), NULL));
#endif
event->is_set = FALSE;
#endif /* __WIN__ */
/* Put to the list of events */
os_mutex_enter(os_sync_mutex);
UT_LIST_ADD_FIRST(os_event_list, os_event_list, event);
os_event_count++;
os_mutex_exit(os_sync_mutex);
return(event);
#endif
}
#ifdef __WIN__
/*************************************************************
Creates an auto-reset event semaphore, i.e., an event
which is automatically reset when a single thread is
released. */
Creates an auto-reset event semaphore, i.e., an event which is automatically
reset when a single thread is released. Works only in Windows. */
os_event_t
os_event_create_auto(
@ -91,24 +169,33 @@ os_event_create_auto(
char* name) /* in: the name of the event, if NULL
the event is created without a name */
{
#ifdef __WIN__
HANDLE event;
os_event_t event;
event = CreateEvent(NULL, /* No security attributes */
event = ut_malloc(sizeof(struct os_event_struct));
event->handle = CreateEvent(NULL,/* No security attributes */
FALSE, /* Auto-reset */
FALSE, /* Initial state nonsignaled */
name);
ut_a(event);
if (!event->handle) {
fprintf(stderr,
"InnoDB: Could not create a Windows auto event semaphore; Windows error %lu\n",
(ulint)GetLastError());
}
/* Put to the list of events */
os_mutex_enter(os_sync_mutex);
UT_LIST_ADD_FIRST(os_event_list, os_event_list, event);
os_event_count++;
os_mutex_exit(os_sync_mutex);
return(event);
#else
/* Does nothing in Posix because we do not need this with MySQL */
UT_NOT_USED(name);
return(NULL);
#endif
}
#endif
/**************************************************************
Sets an event semaphore to the signaled state: lets waiting threads
@ -121,7 +208,7 @@ os_event_set(
{
#ifdef __WIN__
ut_a(event);
ut_a(SetEvent(event));
ut_a(SetEvent(event->handle));
#else
ut_a(event);
@ -150,7 +237,7 @@ os_event_reset(
#ifdef __WIN__
ut_a(event);
ut_a(ResetEvent(event));
ut_a(ResetEvent(event->handle));
#else
ut_a(event);
@ -178,19 +265,31 @@ os_event_free(
#ifdef __WIN__
ut_a(event);
ut_a(CloseHandle(event));
ut_a(CloseHandle(event->handle));
#else
ut_a(event);
os_fast_mutex_free(&(event->os_mutex));
ut_a(0 == pthread_cond_destroy(&(event->cond_var)));
#endif
/* Remove from the list of events */
os_mutex_enter(os_sync_mutex);
UT_LIST_REMOVE(os_event_list, os_event_list, event);
os_event_count--;
os_mutex_exit(os_sync_mutex);
ut_free(event);
#endif
}
/**************************************************************
Waits for an event object until it is in the signaled state. */
Waits for an event object until it is in the signaled state. If
srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS this also exits the
waiting thread when the event becomes signaled (or immediately if the
event is already in the signaled state). */
void
os_event_wait(
@ -203,15 +302,23 @@ os_event_wait(
ut_a(event);
/* Specify an infinite time limit for waiting */
err = WaitForSingleObject(event, INFINITE);
err = WaitForSingleObject(event->handle, INFINITE);
ut_a(err == WAIT_OBJECT_0);
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
os_thread_exit(NULL);
}
#else
os_fast_mutex_lock(&(event->os_mutex));
loop:
if (event->is_set == TRUE) {
os_fast_mutex_unlock(&(event->os_mutex));
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
os_thread_exit(NULL);
}
/* Ok, we may return */
return;
@ -228,7 +335,7 @@ loop:
/**************************************************************
Waits for an event object until it is in the signaled state or
a timeout is exceeded. */
a timeout is exceeded. In Unix the timeout is always infinite. */
ulint
os_event_wait_time(
@ -245,9 +352,9 @@ os_event_wait_time(
ut_a(event);
if (time != OS_SYNC_INFINITE_TIME) {
err = WaitForSingleObject(event, time / 1000);
err = WaitForSingleObject(event->handle, time / 1000);
} else {
err = WaitForSingleObject(event, INFINITE);
err = WaitForSingleObject(event->handle, INFINITE);
}
if (err == WAIT_OBJECT_0) {
@ -271,8 +378,9 @@ os_event_wait_time(
#endif
}
#ifdef __WIN__
/**************************************************************
Waits for any event in an event array. Returns if even a single
Waits for any event in an OS native event array. Returns if even a single
one is signaled or becomes signaled. */
ulint
@ -280,41 +388,35 @@ os_event_wait_multiple(
/*===================*/
/* out: index of the event
which was signaled */
ulint n, /* in: number of events in the
ulint n, /* in: number of events in the
array */
os_event_t* event_array) /* in: pointer to an array of event
os_native_event_t* native_event_array)
/* in: pointer to an array of event
handles */
{
#ifdef __WIN__
DWORD index;
ut_a(event_array);
ut_a(native_event_array);
ut_a(n > 0);
index = WaitForMultipleObjects(n,
event_array,
index = WaitForMultipleObjects(n, native_event_array,
FALSE, /* Wait for any 1 event */
INFINITE); /* Infinite wait time
limit */
ut_a(index >= WAIT_OBJECT_0);
ut_a(index < WAIT_OBJECT_0 + n);
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
os_thread_exit(NULL);
}
return(index - WAIT_OBJECT_0);
#else
ut_a(n == 0);
/* In Posix we can only wait for a single event */
os_event_wait(*event_array);
return(0);
#endif
}
#endif
/*************************************************************
Creates an operating system mutex semaphore.
Because these are slow, the mutex semaphore of the database
itself (sync_mutex_t) should be used where possible. */
Creates an operating system mutex semaphore. Because these are slow, the
mutex semaphore of InnoDB itself (mutex_t) should be used where possible. */
os_mutex_t
os_mutex_create(
@ -331,30 +433,35 @@ os_mutex_create(
FALSE, /* Initial state: no owner */
name);
ut_a(mutex);
#else
os_fast_mutex_t* mutex;
os_mutex_t mutex_str;
UT_NOT_USED(name);
mutex = ut_malloc(sizeof(os_fast_mutex_t));
os_fast_mutex_init(mutex);
#endif
mutex_str = ut_malloc(sizeof(os_mutex_str_t));
mutex_str->handle = mutex;
mutex_str->count = 0;
return(mutex_str);
#else
os_fast_mutex_t* os_mutex;
os_mutex_t mutex_str;
if (os_sync_mutex_inited) {
/* When creating os_sync_mutex itself we cannot reserve it */
os_mutex_enter(os_sync_mutex);
}
UT_NOT_USED(name);
UT_LIST_ADD_FIRST(os_mutex_list, os_mutex_list, mutex_str);
os_mutex = ut_malloc(sizeof(os_fast_mutex_t));
os_mutex_count++;
os_fast_mutex_init(os_mutex);
mutex_str = ut_malloc(sizeof(os_mutex_str_t));
mutex_str->handle = os_mutex;
mutex_str->count = 0;
if (os_sync_mutex_inited) {
os_mutex_exit(os_sync_mutex);
}
return(mutex_str);
#endif
}
/**************************************************************
@ -394,21 +501,14 @@ os_mutex_exit(
/*==========*/
os_mutex_t mutex) /* in: mutex to release */
{
#ifdef __WIN__
ut_a(mutex);
ut_a(mutex->count == 1);
(mutex->count)--;
#ifdef __WIN__
ut_a(ReleaseMutex(mutex->handle));
#else
ut_a(mutex);
ut_a(mutex->count == 1);
(mutex->count)--;
os_fast_mutex_unlock(mutex->handle);
#endif
}
@ -421,10 +521,23 @@ os_mutex_free(
/*==========*/
os_mutex_t mutex) /* in: mutex to free */
{
#ifdef __WIN__
ut_a(mutex);
if (os_sync_mutex_inited) {
os_mutex_enter(os_sync_mutex);
}
UT_LIST_REMOVE(os_mutex_list, os_mutex_list, mutex);
os_mutex_count--;
if (os_sync_mutex_inited) {
os_mutex_exit(os_sync_mutex);
}
#ifdef __WIN__
ut_a(CloseHandle(mutex->handle));
ut_free(mutex);
#else
os_fast_mutex_free(mutex->handle);
@ -452,6 +565,18 @@ os_fast_mutex_init(
ut_a(0 == pthread_mutex_init(fast_mutex, MY_MUTEX_INIT_FAST));
#endif
#endif
if (os_sync_mutex_inited) {
/* When creating os_sync_mutex itself (in Unix) we cannot
reserve it */
os_mutex_enter(os_sync_mutex);
}
os_fast_mutex_count++;
if (os_sync_mutex_inited) {
os_mutex_exit(os_sync_mutex);
}
}
/**************************************************************
@ -499,4 +624,16 @@ os_fast_mutex_free(
#else
ut_a(0 == pthread_mutex_destroy(fast_mutex));
#endif
if (os_sync_mutex_inited) {
/* When freeing the last mutexes, we have
already freed os_sync_mutex */
os_mutex_enter(os_sync_mutex);
}
os_fast_mutex_count--;
if (os_sync_mutex_inited) {
os_mutex_exit(os_sync_mutex);
}
}

View File

@ -1,6 +1,5 @@
/******************************************************
The interface to the operating system
process and thread control primitives
The interface to the operating system thread control primitives
(c) 1995 Innobase Oy
@ -17,6 +16,7 @@ Created 9/8/1995 Heikki Tuuri
#endif
#include "srv0srv.h"
#include "os0sync.h"
/*******************************************************************
Compares two thread ids for equality. */
@ -102,6 +102,10 @@ os_thread_create(
os_thread_t thread;
ulint win_thread_id;
os_mutex_enter(os_sync_mutex);
os_thread_count++;
os_mutex_exit(os_sync_mutex);
thread = CreateThread(NULL, /* no security attributes */
0, /* default size stack */
(LPTHREAD_START_ROUTINE)start_f,
@ -144,6 +148,9 @@ os_thread_create(
exit(1);
}
#endif
os_mutex_enter(os_sync_mutex);
os_thread_count++;
os_mutex_exit(os_sync_mutex);
#if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10)
ret = pthread_create(&pthread, pthread_attr_default, start_f, arg);
@ -170,6 +177,30 @@ os_thread_create(
#endif
}
/*********************************************************************
Exits the current thread. */
void
os_thread_exit(
/*===========*/
void* exit_value) /* in: exit value; in Windows this void*
is cast as a DWORD */
{
#ifdef UNIV_DEBUG_THREAD_CREATION
printf("A thread exits.\n");
printf("Thread id %lu\n", os_thread_pf(os_thread_get_curr_id()));
#endif
os_mutex_enter(os_sync_mutex);
os_thread_count--;
os_mutex_exit(os_sync_mutex);
#ifdef __WIN__
ExitThread((DWORD)exit_value);
#else
pthread_exit(exit_value);
#endif
}
/*********************************************************************
Returns handle to the current thread. */

View File

@ -1275,6 +1275,10 @@ row_ins_unique_report_err(
dtuple_t* entry, /* in: index entry to insert in the index */
dict_index_t* index) /* in: index */
{
#ifdef notdefined
/* Disable reporting to test if the slowdown of REPLACE in 4.0.13 was
caused by this! */
char* buf = dict_unique_err_buf;
/* The foreign err mutex protects also dict_unique_err_buf */
@ -1303,6 +1307,7 @@ row_ins_unique_report_err(
ut_a(strlen(buf) < DICT_FOREIGN_ERR_BUF_LEN);
mutex_exit(&dict_foreign_err_mutex);
#endif
}
/*******************************************************************

View File

@ -868,6 +868,7 @@ srv_release_max_if_no_queries(void)
mutex_exit(&kernel_mutex);
}
#ifdef notdefined
/***********************************************************************
Releases one utility thread if no queries are active and
the high-water mark 2 for the utility is exceeded. */
@ -902,7 +903,6 @@ srv_release_one_if_no_queries(void)
mutex_exit(&kernel_mutex);
}
#ifdef notdefined
/***********************************************************************
Decrements the utility meter by the value given and suspends the calling
thread, which must be an utility thread of the type given, if necessary. */
@ -1013,6 +1013,8 @@ srv_communication_init(
ut_a(ret == 0);
}
#ifdef notdefined
/*************************************************************************
Implements the recovery utility. */
static
@ -1072,6 +1074,7 @@ srv_purge_thread(
return(0);
}
#endif /* notdefined */
/*************************************************************************
Creates the utility threads. */
@ -1102,6 +1105,7 @@ srv_create_utility_threads(void)
ut_a(thread); */
}
#ifdef notdefined
/*************************************************************************
Implements the communication threads. */
static
@ -1151,6 +1155,7 @@ srv_com_thread(
return(0);
}
#endif
/*************************************************************************
Creates the communication threads. */
@ -1171,6 +1176,7 @@ srv_create_com_threads(void)
}
}
#ifdef notdefined
/*************************************************************************
Implements the worker threads. */
static
@ -1215,6 +1221,7 @@ srv_worker_thread(
return(0);
}
#endif
/*************************************************************************
Creates the worker threads. */
@ -1706,6 +1713,16 @@ srv_init(void)
}
}
/*************************************************************************
Frees the OS fast mutex created in srv_init(). */
void
srv_free(void)
/*==========*/
{
os_fast_mutex_free(&srv_conc_mutex);
}
/*************************************************************************
Initializes the synchronization primitives, memory system, and the thread
local storage. */
@ -1714,67 +1731,14 @@ void
srv_general_init(void)
/*==================*/
{
os_sync_init();
sync_init();
mem_init(srv_mem_pool_size);
thr_local_init();
}
#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
/* NetWare requires some cleanup of mutexes */
/*************************************************************************
Deinitializes the synchronization primitives, memory system, and the thread
local storage. */
void
srv_general_free(void)
/*==================*/
{
sync_close();
}
#endif /* __NETWARE__ */
/*======================= InnoDB Server FIFO queue =======================*/
#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
/* NetWare requires some cleanup of mutexes */
/*************************************************************************
Deinitializes the server. */
void
srv_free(void)
/*==========*/
{
srv_conc_slot_t* conc_slot;
srv_slot_t* slot;
ulint i;
for (i = 0; i < OS_THREAD_MAX_N; i++)
{
slot = srv_table_get_nth_slot(i);
os_event_free(slot->event);
}
/* TODO: free(srv_sys->threads); */
for (i = 0; i < OS_THREAD_MAX_N; i++)
{
slot = srv_mysql_table + i;
os_event_free(slot->event);
}
/* TODO: free(srv_mysql_table); */
for (i = 0; i < OS_THREAD_MAX_N; i++)
{
conc_slot = srv_conc_slots + i;
os_event_free(conc_slot->event);
}
}
#endif /* __NETWARE__ */
/*************************************************************************
Puts an OS thread to wait if there are too many concurrent threads
@ -2533,6 +2497,10 @@ srv_lock_timeout_and_monitor_thread(
char* buf;
ulint i;
#ifdef UNIV_DEBUG_THREAD_CREATION
printf("Lock timeout thread starts\n");
printf("Thread id %lu\n", os_thread_pf(os_thread_get_curr_id()));
#endif
UT_NOT_USED(arg);
srv_last_monitor_time = time(NULL);
last_table_monitor_time = time(NULL);
@ -2673,6 +2641,10 @@ loop:
exit_func:
srv_lock_timeout_and_monitor_active = FALSE;
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
os_thread_exit(NULL);
#ifndef __WIN__
return(NULL);
#else
@ -2698,6 +2670,10 @@ srv_error_monitor_thread(
ulint cnt = 0;
UT_NOT_USED(arg);
#ifdef UNIV_DEBUG_THREAD_CREATION
printf("Error monitor thread starts\n");
printf("Thread id %lu\n", os_thread_pf(os_thread_get_curr_id()));
#endif
loop:
srv_error_monitor_active = TRUE;
@ -2734,6 +2710,11 @@ loop:
srv_error_monitor_active = FALSE;
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
os_thread_exit(NULL);
#ifndef __WIN__
return(NULL);
#else
@ -2812,6 +2793,10 @@ srv_master_thread(
UT_NOT_USED(arg);
#ifdef UNIV_DEBUG_THREAD_CREATION
printf("Master thread starts\n");
printf("Thread id %lu\n", os_thread_pf(os_thread_get_curr_id()));
#endif
srv_main_thread_process_no = os_proc_get_number();
srv_main_thread_id = os_thread_pf(os_thread_get_curr_id());
@ -3047,6 +3032,15 @@ background_loop:
n_tables_to_drop = row_drop_tables_for_mysql_in_background();
if (n_tables_to_drop > 0) {
/* Do not monopolize the CPU even if there are tables waiting
in the background drop queue. (It is essentially a bug if
MySQL tries to drop a table while there are still open handles
to it and we had to put it to the background drop queue.) */
os_thread_sleep(100000);
}
srv_main_thread_op_info = (char*)"purging";
if (srv_fast_shutdown && srv_shutdown_state > 0) {
@ -3173,11 +3167,25 @@ suspend_thread:
os_event_wait(event);
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
/* This is only extra safety, the thread should exit
already when the event wait ends */
os_thread_exit(NULL);
}
/* When there is user activity, InnoDB will set the event and the main
thread goes back to loop: */
goto loop;
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit.
The thread actually never comes here because it is exited in an
os_event_wait(). */
os_thread_exit(NULL);
#ifndef __WIN__
return(NULL);
#else

View File

@ -414,8 +414,10 @@ io_handler_thread(
segment = *((ulint*)arg);
/* printf("Io handler thread %lu starts\n", segment); */
#ifdef UNIV_DEBUG_THREAD_CREATION
printf("Io handler thread %lu starts\n", segment);
printf("Thread id %lu\n", os_thread_pf(os_thread_get_curr_id()));
#endif
for (i = 0;; i++) {
fil_aio_wait(segment);
@ -424,6 +426,13 @@ io_handler_thread(
mutex_exit(&ios_mutex);
}
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit.
The thread actually never comes here because it is exited in an
os_event_wait(). */
os_thread_exit(NULL);
#ifndef __WIN__
return(NULL);
#else
@ -1481,9 +1490,7 @@ innobase_start_or_create_for_mysql(void)
os_fast_mutex_unlock(&srv_os_test_mutex);
#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
os_fast_mutex_free(&srv_os_test_mutex); /* all platforms? */
#endif /* __NETWARE__ */
os_fast_mutex_free(&srv_os_test_mutex);
if (srv_print_verbose_log) {
ut_print_timestamp(stderr);
@ -1509,6 +1516,8 @@ innobase_shutdown_for_mysql(void)
/*=============================*/
/* out: DB_SUCCESS or error code */
{
ulint i;
if (!srv_was_started) {
if (srv_is_being_started) {
ut_print_timestamp(stderr);
@ -1521,7 +1530,7 @@ innobase_shutdown_for_mysql(void)
return(DB_SUCCESS);
}
/* Flush buffer pool to disk, write the current lsn to
/* 1. Flush buffer pool to disk, write the current lsn to
the tablespace header(s), and copy all log data to archive */
logs_empty_and_mark_files_at_shutdown();
@ -1533,30 +1542,88 @@ innobase_shutdown_for_mysql(void)
srv_conc_n_threads);
}
#if defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
/*
TODO: Fix this temporary solution
We are having a race condition occure with io_handler_thread threads.
When they yield in os_aio_simulated_handle during shutdown, this
thread was able to free the memory early.
*/
os_thread_yield();
/* 2. Make all threads created by InnoDB to exit */
srv_shutdown_state = SRV_SHUTDOWN_EXIT_THREADS;
/* All threads end up waiting for certain events. Put those events
to the signaled state. Then the threads will exit themselves in
os_thread_event_wait(). */
for (i = 0; i < 1000; i++) {
/* NOTE: IF YOU CREATE THREADS IN INNODB, YOU MUST EXIT THEM
HERE OR EARLIER */
/* 1. Let the lock timeout thread exit */
os_event_set(srv_lock_timeout_thread_event);
/* 2. srv error monitor thread exits automatically, no need
to do anything here */
/* 3. We wake the master thread so that it exits */
srv_wake_master_thread();
/* 4. Exit the i/o threads */
os_aio_wake_all_threads_at_shutdown();
os_mutex_enter(os_sync_mutex);
if (os_thread_count == 0) {
/* All the threads have exited or are just exiting;
NOTE that the threads may not have completed their
exit yet. Should we use pthread_join() to make sure
they have exited? Now we just sleep 0.1 seconds and
hope that is enough! */
os_mutex_exit(os_sync_mutex);
os_thread_sleep(100000);
break;
}
os_mutex_exit(os_sync_mutex);
os_thread_sleep(100000);
}
if (i == 1000) {
fprintf(stderr,
"InnoDB: Warning: %lu threads created by InnoDB had not exited at shutdown!\n",
os_thread_count);
}
/* 3. Free all InnoDB's own mutexes and the os_fast_mutexes inside
them */
sync_close();
/* 4. Free the os_conc_mutex and all os_events and os_mutexes */
/* TODO: Where should this be called? */
srv_free();
os_sync_free();
/* 5. Free all allocated memory and the os_fast_mutex created in
ut0mem.c */
/* TODO: Where should this be called? */
srv_general_free();
#endif
/*
TODO: We should exit the i/o-handler and other utility threads
before freeing all memory. Now this can potentially cause a seg
fault!
*/
#if defined(NOT_WORKING_YET) || defined(__NETWARE__) || defined(SAFE_MUTEX_DETECT_DESTROY)
/* NetWare requires this free */
ut_free_all_mem();
#endif
if (os_thread_count != 0
|| os_event_count != 0
|| os_mutex_count != 0
|| os_fast_mutex_count != 0) {
fprintf(stderr,
"InnoDB: Warning: some resources were not cleaned up in shutdown:\n"
"InnoDB: threads %lu, events %lu, os_mutexes %lu, os_fast_mutexes %lu\n",
os_thread_count, os_event_count, os_mutex_count,
os_fast_mutex_count);
}
if (srv_print_verbose_log) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Shutdown completed\n");
}
return((int) DB_SUCCESS);
}

View File

@ -235,8 +235,7 @@ mutex_create_func(
mutex->cline = cline;
/* Check that lock_word is aligned; this is important on Intel */
ut_a(((ulint)(&(mutex->lock_word))) % 4 == 0);
ut_ad(((ulint)(&(mutex->lock_word))) % 4 == 0);
/* NOTE! The very first mutexes are not put to the mutex list */
@ -266,11 +265,14 @@ mutex_free(
ut_a(mutex_get_lock_word(mutex) == 0);
ut_a(mutex_get_waiters(mutex) == 0);
mutex_enter(&mutex_list_mutex);
if (mutex != &mutex_list_mutex && mutex != &sync_thread_mutex) {
UT_LIST_REMOVE(list, mutex_list, mutex);
mutex_enter(&mutex_list_mutex);
mutex_exit(&mutex_list_mutex);
UT_LIST_REMOVE(list, mutex_list, mutex);
mutex_exit(&mutex_list_mutex);
}
#if !defined(_WIN32) || !defined(UNIV_CAN_USE_X86_ASSEMBLER)
os_fast_mutex_free(&(mutex->os_fast_mutex));
@ -1230,13 +1232,26 @@ sync_init(void)
}
/**********************************************************************
Frees the resources in synchronization data structures. */
Frees the resources in InnoDB's own synchronization data structures. Use
os_sync_free() after calling this. */
void
sync_close(void)
/*===========*/
{
mutex_t* mutex;
sync_array_free(sync_primary_wait_array);
mutex = UT_LIST_GET_FIRST(mutex_list);
while (mutex) {
mutex_free(mutex);
mutex = UT_LIST_GET_FIRST(mutex_list);
}
mutex_free(&mutex_list_mutex);
mutex_free(&sync_thread_mutex);
}
/***********************************************************************

View File

@ -225,6 +225,8 @@ ut_free_all_mem(void)
os_fast_mutex_unlock(&ut_list_mutex);
ut_a(ut_total_allocated_memory == 0);
os_fast_mutex_free(&ut_list_mutex);
}
/**************************************************************************

View File

@ -18,7 +18,7 @@
# This file is public domain and comes with NO WARRANTY of any kind
target = libmysqlclient.la
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@ -DMYSQL_CLIENT
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
LIBS = @CLIENT_LIBS@
INCLUDES = -I$(top_srcdir)/include $(openssl_includes)
@ -28,6 +28,7 @@ libmysqlclient_la_SOURCES = $(target_sources)
libmysqlclient_la_LIBADD = $(target_libadd)
libmysqlclient_la_LDFLAGS = $(target_ldflags)
EXTRA_DIST = Makefile.shared
noinst_HEADERS = client_settings.h
# This is called from the toplevel makefile
link_sources:
@ -79,7 +80,8 @@ nh = my_global.h config-win32.h dbug.h errmsg.h \
m_ctype.h m_string.h \
my_alarm.h my_config.h my_dir.h my_list.h my_net.h my_sys.h \
mysql.h mysql_com.h mysql_version.h mysqld_error.h \
mysys_err.h my_pthread.h thr_alarm.h violite.h hash.h
mysys_err.h my_pthread.h thr_alarm.h violite.h hash.h \
sql_common.h ../libmysql/client_settings.h
# Get a list of the needed objects
lobjs = $(mysysobjects1) $(dbugobjects) $(mystringsobjects) $(sqlobjects)

View File

@ -63,7 +63,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
my_pread.lo mf_cache.lo md5.lo sha1.lo\
my_getopt.lo my_gethostbyname.lo my_port.lo
sqlobjects = net.lo
sql_cmn_objects = pack.lo
sql_cmn_objects = pack.lo client.lo
# Not needed in the minimum library
mysysobjects2 = my_lib.lo

View File

@ -0,0 +1,41 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 */
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | \
CLIENT_LOCAL_FILES | CLIENT_TRANSACTIONS | \
CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION)
sig_handler pipe_sig_handler(int sig __attribute__((unused)));
my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list);
void read_user_name(char *name);
my_bool send_file_to_server(MYSQL *mysql, const char *filename);
/*
Let the user specify that we don't want SIGPIPE; This doesn't however work
with threaded applications as we can have multiple read in progress.
*/
#if !defined(__WIN__) && defined(SIGPIPE) && !defined(THREAD)
#define init_sigpipe_variables sig_return old_signal_handler=(sig_return) 0;
#define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE,pipe_sig_handler)
#define reset_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) signal(SIGPIPE,old_signal_handler);
#else
#define init_sigpipe_variables
#define set_sigpipe(mysql)
#define reset_sigpipe(mysql)
#endif

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,43 @@ LIBRARY LIBMYSQL
DESCRIPTION 'MySQL 4.1 Client Library'
VERSION 6.0
EXPORTS
_dig_vec
bmove_upp
delete_dynamic
free_defaults
getopt_compare_strings
getopt_ull_limit_value
handle_options
init_dynamic_array
insert_dynamic
int2str
is_prefix
list_add
list_delete
load_defaults
max_allowed_packet
my_end
my_getopt_print_errors
my_init
my_malloc
my_memdup
my_no_flags_free
my_path
my_print_help
my_print_variables
my_realloc
my_strdup
my_thread_end
my_thread_init
myodbc_remove_escape
mysql_affected_rows
mysql_autocommit
mysql_bind_param
mysql_bind_result
mysql_change_user
mysql_character_set_name
mysql_close
mysql_commit
mysql_data_seek
mysql_debug
mysql_dump_debug_info
@ -11,6 +46,9 @@ EXPORTS
mysql_errno
mysql_error
mysql_escape_string
mysql_execute
mysql_fetch
mysql_fetch_column
mysql_fetch_field
mysql_fetch_field_direct
mysql_fetch_fields
@ -32,112 +70,54 @@ EXPORTS
mysql_list_fields
mysql_list_processes
mysql_list_tables
mysql_more_results
mysql_next_result
mysql_num_fields
mysql_num_rows
mysql_odbc_escape_string
mysql_options
mysql_param_count
mysql_param_result
mysql_ping
mysql_prepare
mysql_prepare_result
mysql_query
mysql_read_query_result
mysql_real_connect
mysql_real_escape_string
mysql_real_query
mysql_refresh
mysql_rollback
mysql_row_seek
mysql_row_tell
mysql_select_db
mysql_send_long_data
mysql_send_query
mysql_shutdown
mysql_ssl_set
mysql_stat
mysql_stmt_affected_rows
mysql_stmt_close
mysql_stmt_data_seek
mysql_stmt_errno
mysql_stmt_error
mysql_stmt_free_result
mysql_stmt_num_rows
mysql_stmt_row_seek
mysql_stmt_row_tell
mysql_stmt_store_result
mysql_store_result
mysql_thread_id
mysql_thread_safe
mysql_use_result
bmove_upp
delete_dynamic
_dig_vec
init_dynamic_array
insert_dynamic
int2str
is_prefix
list_add
list_delete
max_allowed_packet
my_init
my_end
my_strdup
my_malloc
my_memdup
my_no_flags_free
my_realloc
my_thread_end
my_thread_init
mysql_warning_count
net_buffer_length
set_dynamic
strcend
strcont
strdup_root
strfill
strinstr
strmake
strmov
strxmov
myodbc_remove_escape
mysql_thread_safe
mysql_character_set_name
mysql_change_user
mysql_send_query
mysql_read_query_result
mysql_real_escape_string
mysql_ssl_set
mysql_real_connect
mysql_master_query
mysql_master_send_query
mysql_slave_query
mysql_slave_send_query
mysql_enable_rpl_parse
mysql_disable_rpl_parse
mysql_rpl_parse_enabled
mysql_enable_reads_from_master
mysql_disable_reads_from_master
mysql_reads_from_master_enabled
mysql_rpl_query_type
mysql_rpl_probe
mysql_set_master
mysql_add_slave
my_getopt_print_errors
handle_options
my_print_help
my_print_variables
getopt_ull_limit_value
getopt_compare_strings
mysql_warning_count
mysql_prepare
mysql_execute
mysql_param_count
mysql_bind_param
mysql_bind_result
mysql_param_result
mysql_prepare_result
mysql_stmt_close
mysql_stmt_error
mysql_stmt_errno
mysql_fetch
mysql_fetch_column
mysql_send_long_data
mysql_next_result
mysql_stmt_affected_rows
mysql_stmt_store_result
mysql_stmt_data_seek
mysql_stmt_row_seek
mysql_stmt_row_tell
mysql_stmt_num_rows
mysql_more_results
mysql_commit
mysql_rollback
mysql_autocommit
load_defaults
free_defaults
my_path

View File

@ -42,15 +42,15 @@ sqlsources = derror.cc field.cc field_conv.cc filesort.cc \
hostname.cc init.cc password.c \
item.cc item_buff.cc item_cmpfunc.cc item_create.cc \
item_func.cc item_strfunc.cc item_sum.cc item_timefunc.cc \
item_uniq.cc item_subselect.cc item_row.cc\
key.cc lock.cc log.cc log_event.cc mf_iocache.cc\
mini_client.cc protocol.cc net_serv.cc opt_ft.cc opt_range.cc \
item_geofunc.cc item_uniq.cc item_subselect.cc item_row.cc\
key.cc lock.cc log.cc log_event.cc sql_state.c \
protocol.cc net_serv.cc opt_ft.cc opt_range.cc \
opt_sum.cc procedure.cc records.cc sql_acl.cc \
repl_failsafe.cc slave.cc sql_load.cc sql_olap.cc \
sql_load.cc sql_olap.cc \
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc \
sql_lex.cc sql_list.cc sql_manager.cc sql_map.cc sql_parse.cc \
sql_prepare.cc sql_derived.cc sql_rename.cc sql_repl.cc \
sql_prepare.cc sql_derived.cc sql_rename.cc \
sql_select.cc sql_do.cc sql_show.cc set_var.cc \
sql_string.cc sql_table.cc sql_test.cc sql_udf.cc \
sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc \

View File

@ -183,7 +183,7 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
MY_INIT((char *)"mysql_embedded"); // init my_sys library & pthreads
}
if (init_common_variables("my", argc, argv, (const char **)groups))
if (init_common_variables("my", *argcp, *argvp, (const char **)groups))
{
mysql_server_end();
return 1;

View File

@ -49,6 +49,8 @@
static my_bool mysql_client_init=0;
uint mysql_port=0;
my_string mysql_unix_port=0;
const char *not_error_sqlstate= "00000";
const char *sql_protocol_names_lib[] =
{ "TCP", "SOCKET", "PIPE", "MEMORY",NullS };
TYPELIB sql_protocol_typelib = {array_elements(sql_protocol_names_lib)-1,"",
@ -450,6 +452,7 @@ static inline int mysql_init_charset(MYSQL *mysql)
if (!mysql->charset)
{
mysql->last_errno=CR_CANT_READ_CHARSET;
strmov(mysql->sqlstate, "HY0000");
if (mysql->options.charset_dir)
sprintf(mysql->last_error,ER(mysql->last_errno),
charset_name ? charset_name : "unknown",
@ -515,6 +518,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
client_flag&= ~CLIENT_COMPRESS;
if (db)
client_flag|=CLIENT_CONNECT_WITH_DB;
mysql->server_status= SERVER_STATUS_AUTOCOMMIT;
if (mysql->options.init_commands)
{
@ -1039,9 +1043,9 @@ mysql_list_fields(MYSQL *mysql __attribute__((unused)), const char *table __attr
/* List all running processes (threads) in server */
MYSQL_RES * STDCALL
mysql_list_processes(MYSQL *mysql)
mysql_list_processes(MYSQL *mysql __attribute__((unused)))
{
#ifdef DUMMY
#ifdef FOR_THE_FUTURE
MYSQL_DATA *fields;
uint field_count;
uchar *pos;
@ -1062,7 +1066,7 @@ mysql_list_processes(MYSQL *mysql)
mysql->status=MYSQL_STATUS_GET_RESULT;
mysql->field_count=field_count;
DBUG_RETURN(mysql_store_result(mysql));
#endif /*DUMMY*/
#endif /* FOR_THE_FUTURE */
return 0;
}
@ -1130,6 +1134,7 @@ mysql_stat(MYSQL *mysql)
if (!mysql->net.read_pos[0])
{
mysql->net.last_errno=CR_WRONG_HOST_INFO;
strmov(mysql->sqlstate, unknown_sqlstate);
strmov(mysql->net.last_error, ER(mysql->net.last_errno));
return mysql->net.last_error;
}
@ -1284,12 +1289,12 @@ unsigned int STDCALL mysql_field_count(MYSQL *mysql)
my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql)
{
return (mysql)->affected_rows;
return mysql->affected_rows;
}
my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql)
{
return (mysql)->insert_id;
return mysql->insert_id;
}
uint STDCALL mysql_errno(MYSQL *mysql)
@ -1297,6 +1302,11 @@ uint STDCALL mysql_errno(MYSQL *mysql)
return mysql->last_errno;
}
const char *STDCALL mysql_sqlstate(MYSQL *mysql)
{
return mysql->sqlstate;
}
const char * STDCALL mysql_error(MYSQL *mysql)
{
return mysql->last_error;
@ -1528,3 +1538,96 @@ myodbc_remove_escape(MYSQL *mysql,char *name)
}
*to=0;
}
/********************************************************************
Transactional APIs
*********************************************************************/
/*
Commit the current transaction
*/
my_bool STDCALL mysql_commit(MYSQL * mysql)
{
DBUG_ENTER("mysql_commit");
DBUG_RETURN((my_bool) mysql_real_query(mysql, "commit", 6));
}
/*
Rollback the current transaction
*/
my_bool STDCALL mysql_rollback(MYSQL * mysql)
{
DBUG_ENTER("mysql_rollback");
DBUG_RETURN((my_bool) mysql_real_query(mysql, "rollback", 8));
}
/*
Set autocommit to either true or false
*/
my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode)
{
DBUG_ENTER("mysql_autocommit");
DBUG_PRINT("enter", ("mode : %d", auto_mode));
if (auto_mode) /* set to true */
DBUG_RETURN((my_bool) mysql_real_query(mysql, "set autocommit=1", 16));
DBUG_RETURN((my_bool) mysql_real_query(mysql, "set autocommit=0", 16));
}
/********************************************************************
Multi query execution + SPs APIs
*********************************************************************/
/*
Returns if there are any more query results exists to be read using
mysql_next_result()
*/
my_bool STDCALL mysql_more_results(MYSQL *mysql)
{
my_bool res;
DBUG_ENTER("mysql_more_results");
res= ((mysql->server_status & SERVER_MORE_RESULTS_EXISTS) ?
1: 0);
DBUG_PRINT("exit",("More results exists ? %d", res));
DBUG_RETURN(res);
}
/*
Reads and returns the next query results
*/
my_bool STDCALL mysql_next_result(MYSQL *mysql)
{
DBUG_ENTER("mysql_next_result");
mysql->last_error[0]= 0;
mysql->last_errno= 0;
strmov(mysql->sqlstate, not_error_sqlstate);
mysql->affected_rows= ~(my_ulonglong) 0;
if (mysql->server_status & SERVER_MORE_RESULTS_EXISTS)
DBUG_RETURN(mysql_read_query_result(mysql));
DBUG_RETURN(0);
}
my_bool STDCALL
mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
const char *key __attribute__((unused)),
const char *cert __attribute__((unused)),
const char *ca __attribute__((unused)),
const char *capath __attribute__((unused)),
const char *cipher __attribute__((unused)))
{
return 0;
}

View File

@ -1,65 +1,130 @@
LIBRARY LIBMYSQLD
DESCRIPTION 'MySQL 4.0 Embedded Server Library'
VERSION 4.0
DESCRIPTION 'MySQL 4.1 Embedded Server Library'
VERSION 4.1
EXPORTS
mysql_server_end
mysql_server_init
mysql_use_result
mysql_thread_safe
mysql_thread_id
mysql_store_result
mysql_stat
mysql_shutdown
mysql_select_db
mysql_row_tell
mysql_row_seek
mysql_real_query
mysql_real_connect
mysql_query
mysql_ping
mysql_options
mysql_num_rows
mysql_num_fields
mysql_list_tables
mysql_list_processes
mysql_list_fields
mysql_list_dbs
mysql_kill
mysql_insert_id
mysql_init
mysql_info
mysql_get_server_info
mysql_get_proto_info
mysql_get_host_info
mysql_get_client_info
mysql_free_result
mysql_field_tell
_dig_vec
bmove_upp
delete_dynamic
free_defaults
getopt_compare_strings
getopt_ull_limit_value
handle_options
init_dynamic_array
insert_dynamic
int2str
is_prefix
list_add
list_delete
load_defaults
max_allowed_packet
my_end
my_getopt_print_errors
my_init
my_malloc
my_memdup
my_no_flags_free
my_path
my_print_help
my_print_variables
my_realloc
my_strdup
my_thread_end
my_thread_init
myodbc_remove_escape
mysql_affected_rows
mysql_autocommit
mysql_change_user
mysql_character_set_name
mysql_close
mysql_commit
mysql_data_seek
mysql_debug
mysql_dump_debug_info
mysql_eof
mysql_errno
mysql_error
mysql_escape_string
mysql_fetch_field
mysql_fetch_field_direct
mysql_fetch_fields
mysql_fetch_lengths
mysql_fetch_row
mysql_field_count
mysql_field_seek
mysql_fetch_row
mysql_fetch_lengths
mysql_fetch_fields
mysql_fetch_field_direct
mysql_fetch_field
mysql_escape_string
mysql_real_escape_string
mysql_error
mysql_errno
mysql_eof
mysql_dump_debug_info
mysql_drop_db
mysql_debug
mysql_data_seek
mysql_create_db
mysql_character_set_name
mysql_change_user
mysql_connect
mysql_close
mysql_affected_rows
mysql_thread_init
mysql_thread_end
mysql_send_query
mysql_read_query_result
mysql_refresh
mysql_field_tell
mysql_free_result
mysql_get_client_info
mysql_get_host_info
mysql_get_proto_info
mysql_get_server_info
mysql_info
mysql_init
mysql_insert_id
mysql_kill
mysql_list_dbs
mysql_list_fields
mysql_list_processes
mysql_list_tables
mysql_more_results
mysql_next_result
mysql_num_fields
mysql_num_rows
mysql_odbc_escape_string
myodbc_remove_escape
mysql_options
mysql_ping
mysql_query
mysql_read_query_result
mysql_real_connect
mysql_real_escape_string
mysql_real_query
mysql_refresh
mysql_rollback
mysql_row_seek
mysql_row_tell
mysql_select_db
mysql_send_query
mysql_shutdown
mysql_ssl_set
mysql_stat
mysql_store_result
mysql_sqlstate
mysql_thread_id
mysql_thread_safe
mysql_use_result
mysql_warning_count
net_buffer_length
set_dynamic
strcend
strcont
strdup_root
strfill
strinstr
strmake
strmov
strxmov
mysql_server_end
mysql_server_init
get_tty_password
sql_protocol_typelib
mysql_get_server_version
mysql_sqlstate
charsets_dir
disabled_my_option
my_charset_latin1
init_alloc_root
my_progname
get_charset_by_csname
print_defaults
find_type
strxnmov
strend
my_fopen
my_fclose
unpack_filename
str2int
int10_to_str
longlong10_to_str
my_snprintf_8bit
alloc_root
free_root
my_read

View File

@ -2,7 +2,7 @@
.SH NAME
mysql_fix_privilege_tables \- Fixes MySQL privilege tables.
.SH SYNOPSIS
mysql_fix_privilege_tables [options]
mysql_fix_privilege_tables [mysql_root_password]
.SH DESCRIPTION
This scripts updates the mysql.user, mysql.db, mysql.host and the
mysql.func tables to MySQL 3.22.14 and above.
@ -10,10 +10,9 @@ mysql.func tables to MySQL 3.22.14 and above.
This is needed if you want to use the new GRANT functions,
CREATE AGGREGATE FUNCTION or want to use the more secure passwords in 3.23
If you get 'Access denied' errors, you should run this script again
and give the MySQL root user password as an argument!
If you get 'Access denied' errors, run the script again
and give the MySQL root user password as an argument.
For more information start the program with '--help'.
.SH "SEE ALSO"
mysql (1), mysqld (1)
.SH AUTHOR

View File

@ -47,6 +47,7 @@ libmyisam_a_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.c \
mi_range.c mi_dbug.c mi_checksum.c mi_log.c \
mi_changed.c mi_static.c mi_delete_all.c \
mi_delete_table.c mi_rename.c mi_check.c \
mi_preload.c \
ft_parser.c ft_stopwords.c ft_static.c \
ft_update.c ft_boolean_search.c ft_nlq_search.c sort.c \
rt_index.c rt_key.c rt_mbr.c rt_split.c sp_key.c

View File

@ -34,21 +34,23 @@ static uint lengths[256];
static struct my_option my_long_options[] =
{
{"dump", 'd', "Dump index (incl. data offsets and word weights)",
{"dump", 'd', "Dump index (incl. data offsets and word weights).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"stats", 's', "Report global stats",
{"stats", 's', "Report global stats.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Be verbose",
{"verbose", 'v', "Be verbose.",
(gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"count", 'c', "Calculate per-word stats (counts and global weights)",
{"count", 'c', "Calculate per-word stats (counts and global weights).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"length", 'l', "Report length distribution",
{"length", 'l', "Report length distribution.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"execute", 'e', "Execute given query", (gptr*) &query, (gptr*) &query, 0,
#ifdef DISABLED
{"execute", 'e', "Execute given query.", (gptr*) &query, (gptr*) &query, 0,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"help", 'h', "Display help and exit",
#endif
{"help", 'h', "Display help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Synonym for -h",
{"help", '?', "Synonym for -h.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};

View File

@ -31,18 +31,24 @@
void _mi_ft_segiterator_init(MI_INFO *info, uint keynr, const byte *record,
FT_SEG_ITERATOR *ftsi)
{
DBUG_ENTER("_mi_ft_segiterator_init");
ftsi->num=info->s->keyinfo[keynr].keysegs;
ftsi->seg=info->s->keyinfo[keynr].seg;
ftsi->rec=record;
DBUG_VOID_RETURN;
}
void _mi_ft_segiterator_dummy_init(const byte *record, uint len,
FT_SEG_ITERATOR *ftsi)
{
DBUG_ENTER("_mi_ft_segiterator_dummy_init");
ftsi->num=1;
ftsi->seg=0;
ftsi->pos=record;
ftsi->len=len;
DBUG_VOID_RETURN;
}
/*
@ -56,14 +62,26 @@ void _mi_ft_segiterator_dummy_init(const byte *record, uint len,
uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi)
{
if (!ftsi->num) return 0; else ftsi->num--;
if (!ftsi->seg) return 1; else ftsi->seg--;
DBUG_ENTER("_mi_ft_segiterator");
if (!ftsi->num)
{
DBUG_RETURN(0);
}
else
ftsi->num--;
if (!ftsi->seg)
{
DBUG_RETURN(1);
}
else
ftsi->seg--;
if (ftsi->seg->null_bit &&
(ftsi->rec[ftsi->seg->null_pos] & ftsi->seg->null_bit))
{
ftsi->pos=0;
return 1;
DBUG_RETURN(1);
}
ftsi->pos= ftsi->rec+ftsi->seg->start;
if (ftsi->seg->flag & HA_VAR_LENGTH)
@ -71,7 +89,7 @@ uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi)
ftsi->len=uint2korr(ftsi->pos);
ftsi->pos+=2; /* Skip VARCHAR length */
set_if_smaller(ftsi->len,ftsi->seg->length);
return 1;
DBUG_RETURN(1);
}
if (ftsi->seg->flag & HA_BLOB_PART)
{
@ -79,10 +97,10 @@ uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi)
memcpy_fixed((char*) &ftsi->pos, ftsi->pos+ftsi->seg->bit_start,
sizeof(char*));
set_if_smaller(ftsi->len,ftsi->seg->length);
return 1;
DBUG_RETURN(1);
}
ftsi->len=ftsi->seg->length;
return 1;
DBUG_RETURN(1);
}
@ -91,6 +109,8 @@ uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi)
uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record)
{
FT_SEG_ITERATOR ftsi;
DBUG_ENTER("_mi_ft_parse");
_mi_ft_segiterator_init(info, keynr, record, &ftsi);
ft_parse_init(parsed, info->s->keyinfo[keynr].seg->charset);
@ -98,9 +118,9 @@ uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record)
{
if (ftsi.pos)
if (ft_parse(parsed, (byte *)ftsi.pos, ftsi.len))
return 1;
DBUG_RETURN(1);
}
return 0;
DBUG_RETURN(0);
}
FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr,
@ -108,32 +128,35 @@ FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr,
const byte *record)
{
TREE ptree;
DBUG_ENTER("_mi_ft_parserecord");
bzero((char*) &ptree, sizeof(ptree));
if (_mi_ft_parse(&ptree, info, keynr, record))
return NULL;
DBUG_RETURN(NULL);
return ft_linearize(&ptree);
DBUG_RETURN(ft_linearize(&ptree));
}
static int _mi_ft_store(MI_INFO *info, uint keynr, byte *keybuf,
FT_WORD *wlist, my_off_t filepos)
{
uint key_length;
DBUG_ENTER("_mi_ft_store");
for (; wlist->pos; wlist++)
{
key_length=_ft_make_key(info,keynr,keybuf,wlist,filepos);
if (_mi_ck_write(info,keynr,(uchar*) keybuf,key_length))
return 1;
DBUG_RETURN(1);
}
return 0;
DBUG_RETURN(0);
}
static int _mi_ft_erase(MI_INFO *info, uint keynr, byte *keybuf,
FT_WORD *wlist, my_off_t filepos)
{
uint key_length, err=0;
DBUG_ENTER("_mi_ft_erase");
for (; wlist->pos; wlist++)
{
@ -141,7 +164,7 @@ static int _mi_ft_erase(MI_INFO *info, uint keynr, byte *keybuf,
if (_mi_ck_delete(info,keynr,(uchar*) keybuf,key_length))
err=1;
}
return err;
DBUG_RETURN(err);
}
/*
@ -156,6 +179,8 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2)
{
FT_SEG_ITERATOR ftsi1, ftsi2;
CHARSET_INFO *cs=info->s->keyinfo[keynr].seg->charset;
DBUG_ENTER("_mi_ft_cmp");
_mi_ft_segiterator_init(info, keynr, rec1, &ftsi1);
_mi_ft_segiterator_init(info, keynr, rec2, &ftsi2);
@ -165,9 +190,9 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2)
(!ftsi1.pos || !ftsi2.pos ||
mi_compare_text(cs, (uchar*) ftsi1.pos,ftsi1.len,
(uchar*) ftsi2.pos,ftsi2.len,0)))
return THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT;
DBUG_RETURN(THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT);
}
return GEE_THEY_ARE_ABSOLUTELY_IDENTICAL;
DBUG_RETURN(GEE_THEY_ARE_ABSOLUTELY_IDENTICAL);
}
@ -181,6 +206,7 @@ int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
CHARSET_INFO *cs=info->s->keyinfo[keynr].seg->charset;
uint key_length;
int cmp, cmp2;
DBUG_ENTER("_mi_ft_update");
if (!(old_word=oldlist=_mi_ft_parserecord(info, keynr, keybuf, oldrec)))
goto err0;
@ -219,7 +245,7 @@ err2:
err1:
my_free((char*) oldlist,MYF(0));
err0:
return error;
DBUG_RETURN(error);
}
@ -230,13 +256,14 @@ int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
{
int error= -1;
FT_WORD *wlist;
DBUG_ENTER("_mi_ft_add");
if ((wlist=_mi_ft_parserecord(info, keynr, keybuf, record)))
{
error=_mi_ft_store(info,keynr,keybuf,wlist,pos);
my_free((char*) wlist,MYF(0));
}
return error;
DBUG_RETURN(error);
}
@ -247,27 +274,34 @@ int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
{
int error= -1;
FT_WORD *wlist;
DBUG_ENTER("_mi_ft_del");
DBUG_PRINT("enter",("keynr: %d",keynr));
if ((wlist=_mi_ft_parserecord(info, keynr, keybuf, record)))
{
error=_mi_ft_erase(info,keynr,keybuf,wlist,pos);
my_free((char*) wlist,MYF(0));
}
return error;
DBUG_PRINT("exit",("Return: %d",error));
DBUG_RETURN(error);
}
uint _ft_make_key(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wptr,
my_off_t filepos)
{
byte buf[HA_FT_MAXLEN+16];
DBUG_ENTER("_ft_make_key");
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
float weight=(float) ((filepos==HA_OFFSET_ERROR) ? 0 : wptr->weight);
mi_float4store(buf,weight);
{
float weight=(float) ((filepos==HA_OFFSET_ERROR) ? 0 : wptr->weight);
mi_float4store(buf,weight);
}
#else
#error
#endif
int2store(buf+HA_FT_WLEN,wptr->len);
memcpy(buf+HA_FT_WLEN+2,wptr->pos,wptr->len);
return _mi_make_key(info,keynr,(uchar*) keybuf,buf,filepos);
DBUG_RETURN(_mi_make_key(info,keynr,(uchar*) keybuf,buf,filepos));
}

View File

@ -441,7 +441,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
mi_int2store(share.state.header.base_info_length,MI_BASE_INFO_SIZE);
mi_int2store(share.state.header.base_pos,base_pos);
share.state.header.language= (ci->language ?
ci->language : MY_CHARSET_CURRENT);
ci->language : default_charset_info->number);
share.state.header.max_block_size=max_key_block_length/MI_MIN_KEY_BLOCK_LENGTH;
share.state.dellink = HA_OFFSET_ERROR;

View File

@ -33,7 +33,7 @@ static int underflow(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *anc_buff,
static uint remove_key(MI_KEYDEF *keyinfo,uint nod_flag,uchar *keypos,
uchar *lastkey,uchar *page_end,
my_off_t *next_block);
static int _mi_ck_real_delete(register MI_INFO *info, MI_KEYDEF *keyinfo,
static int _mi_ck_real_delete(register MI_INFO *info,MI_KEYDEF *keyinfo,
uchar *key, uint key_length, my_off_t *root);
@ -188,6 +188,7 @@ static int _mi_ck_real_delete(register MI_INFO *info, MI_KEYDEF *keyinfo,
}
err:
my_afree((gptr) root_buff);
DBUG_PRINT("exit",("Return: %d",error));
DBUG_RETURN(error);
} /* _mi_ck_real_delete */
@ -234,6 +235,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (subkeys >= 0)
{
/* normal word, one-level tree structure */
DBUG_PRINT("info",("FT1"));
flag=(*keyinfo->bin_search)(info,keyinfo,anc_buff,key,USE_WHOLE_KEY,
comp_flag, &keypos, lastkey, &last_key);
/* fall through to normal delete */
@ -250,13 +252,15 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (subkeys == -1)
{
/* the last entry in sub-tree */
DBUG_PRINT("info",("FT2: the last entry"));
_mi_dispose(info, keyinfo, root);
/* fall through to normal delete */
}
else
{
DBUG_PRINT("info",("FT2: going down"));
keyinfo=&info->s->ft2_keyinfo;
kpos-=keyinfo->keylength; /* we'll modify key entry 'in vivo' */
kpos-=keyinfo->keylength+nod_flag; /* we'll modify key entry 'in vivo' */
key+=off;
ret_value=_mi_ck_real_delete(info, &info->s->ft2_keyinfo,
key, HA_FT_WLEN, &root);
@ -265,6 +269,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
ft_intXstore(kpos, subkeys);
if (!ret_value)
ret_value=_mi_write_keypage(info,keyinfo,page,anc_buff);
DBUG_PRINT("exit",("Return: %d",ret_value));
DBUG_RETURN(ret_value);
}
}
@ -279,6 +284,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
{
DBUG_PRINT("error",("Couldn't allocate memory"));
my_errno=ENOMEM;
DBUG_PRINT("exit",("Return: %d",-1));
DBUG_RETURN(-1);
}
if (!_mi_fetch_keypage(info,keyinfo,leaf_page,leaf_buff,0))
@ -304,14 +310,20 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
tmp=remove_key(keyinfo,nod_flag,keypos,lastkey,anc_buff+length,
&next_block);
if (tmp == 0)
{
DBUG_PRINT("exit",("Return: %d",0));
DBUG_RETURN(0);
}
length-= tmp;
mi_putint(anc_buff,length,nod_flag);
if (!nod_flag)
{ /* On leaf page */
if (_mi_write_keypage(info,keyinfo,page,anc_buff))
{
DBUG_PRINT("exit",("Return: %d",-1));
DBUG_RETURN(-1);
}
/* Page will be update later if we return 1 */
DBUG_RETURN(test(length <= (info->quick_mode ? MI_MIN_KEYBLOCK_LENGTH :
(uint) keyinfo->underflow_block_length)));
@ -348,6 +360,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
DBUG_DUMP("page",(byte*) anc_buff,mi_getint(anc_buff));
}
my_afree((byte*) leaf_buff);
DBUG_PRINT("exit",("Return: %d",ret_value));
DBUG_RETURN(ret_value);
err:
my_afree((byte*) leaf_buff);

View File

@ -367,6 +367,9 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
if (!share->state.header.uniques)
info->opt_flag|= OPT_NO_ROWS;
break;
case HA_EXTRA_PRELOAD_BUFFER_SIZE:
info->preload_buff_size= *((ulong *) extra_arg);
break;
case HA_EXTRA_KEY_CACHE:
case HA_EXTRA_NO_KEY_CACHE:
default:

View File

@ -28,6 +28,9 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo,
{
uchar *tmp;
uint page_size;
DBUG_ENTER("_mi_fetch_keypage");
DBUG_PRINT("enter",("page: %ld",page));
tmp=(uchar*) key_cache_read(info->s->kfile,page,(byte*) buff,
(uint) keyinfo->block_length,
(uint) keyinfo->block_length,
@ -39,7 +42,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo,
DBUG_PRINT("error",("Got errno: %d from key_cache_read",my_errno));
info->last_keypage=HA_OFFSET_ERROR;
my_errno=HA_ERR_CRASHED;
return 0;
DBUG_RETURN(0);
}
info->last_keypage=page;
page_size=mi_getint(tmp);
@ -51,7 +54,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo,
my_errno = HA_ERR_CRASHED;
tmp = 0;
}
return tmp;
DBUG_RETURN(tmp);
} /* _mi_fetch_keypage */
@ -61,6 +64,8 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo,
my_off_t page, uchar *buff)
{
reg3 uint length;
DBUG_ENTER("_mi_write_keypage");
#ifndef FAST /* Safety check */
if (page < info->s->base.keystart ||
page+keyinfo->block_length > info->state->key_file_length ||
@ -71,7 +76,7 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo,
(long) info->state->key_file_length,
(long) page));
my_errno=EINVAL;
return(-1);
DBUG_RETURN((-1));
}
DBUG_PRINT("page",("write page at: %lu",(long) page,buff));
DBUG_DUMP("buff",(byte*) buff,mi_getint(buff));
@ -87,10 +92,10 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo,
length=keyinfo->block_length;
}
#endif
return (key_cache_write(info->s->kfile,page,(byte*) buff,length,
DBUG_RETURN((key_cache_write(info->s->kfile,page,(byte*) buff,length,
(uint) keyinfo->block_length,
(int) ((info->lock_type != F_UNLCK) ||
info->s->delay_key_write)));
info->s->delay_key_write))));
} /* mi_write_keypage */

114
myisam/mi_preload.c Normal file
View File

@ -0,0 +1,114 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 */
/*
Preload indexes into key cache
*/
#include "myisamdef.h"
/*
Preload pages of the index file for a table into the key cache
SYNOPSIS
mi_preload()
info open table
map map of indexes to preload into key cache
ignore_leaves only non-leaves pages are to be preloaded
RETURN VALUE
0 if a success. error code - otherwise.
NOTES.
At present pages for all indexes are preloaded.
In future only pages for indexes specified in the key_map parameter
of the table will be preloaded.
*/
int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
{
uint i;
ulong length, block_length= 0;
uchar *buff= NULL;
MYISAM_SHARE* share= info->s;
uint keys= share->state.header.keys;
MI_KEYDEF *keyinfo= share->keyinfo;
my_off_t key_file_length= share->state.state.key_file_length;
my_off_t pos= share->base.keystart;
DBUG_ENTER("mi_preload");
if (!keys || !key_map || key_file_length == pos)
DBUG_RETURN(0);
block_length= keyinfo[0].block_length;
/* Check whether all indexes use the same block size */
for (i= 1 ; i < keys ; i++)
{
if (keyinfo[i].block_length != block_length)
DBUG_RETURN(my_errno= HA_ERR_NON_UNIQUE_BLOCK_SIZE);
}
length= info->preload_buff_size/block_length * block_length;
set_if_bigger(length, block_length);
if (!(buff= (uchar *) my_malloc(length, MYF(MY_WME))))
DBUG_RETURN(my_errno= HA_ERR_OUT_OF_MEM);
if (flush_key_blocks(share->kfile, FLUSH_RELEASE))
goto err;
do
{
/* Read the next block of index file into the preload buffer */
if ((my_off_t) length > (key_file_length-pos))
length= (ulong) (key_file_length-pos);
if (my_pread(share->kfile, (byte*) buff, length, pos, MYF(MY_FAE)))
goto err;
if (ignore_leaves)
{
uchar *end= buff+length;
do
{
if (mi_test_if_nod(buff))
{
if (key_cache_insert(share->kfile, pos, (byte*) buff, block_length))
goto err;
}
pos+= block_length;
}
while ((buff+= block_length) != end);
buff= end-length;
}
else
{
if (key_cache_insert(share->kfile, pos, (byte*) buff, length))
goto err;
pos+= length;
}
}
while (pos != key_file_length);
my_free(buff, MYF(0));
DBUG_RETURN(0);
err:
my_free(buff, MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(my_errno= errno);
}

View File

@ -99,7 +99,7 @@ static int run_test(const char *filename)
keyinfo[0].seg[0].length=key_length;
keyinfo[0].seg[0].null_bit= null_fields ? 2 : 0;
keyinfo[0].seg[0].null_pos=0;
keyinfo[0].seg[0].language=MY_CHARSET_CURRENT;
keyinfo[0].seg[0].language= default_charset_info->number;
if (pack_seg & HA_BLOB_PART)
{
keyinfo[0].seg[0].bit_start=4; /* Length of blob length */
@ -122,7 +122,7 @@ static int run_test(const char *filename)
uniqueseg[i].start=start;
start+=recinfo[i+1].length;
uniqueseg[i].length=recinfo[i+1].length;
uniqueseg[i].language=MY_CHARSET_CURRENT;
uniqueseg[i].language= default_charset_info->number;
}
uniqueseg[0].type= key_type;
uniqueseg[0].null_bit= null_fields ? 2 : 0;

View File

@ -87,7 +87,7 @@ int main(int argc, char *argv[])
keyinfo[0].seg[0].start=0;
keyinfo[0].seg[0].length=6;
keyinfo[0].seg[0].type=HA_KEYTYPE_TEXT;
keyinfo[0].seg[0].language=MY_CHARSET_CURRENT;
keyinfo[0].seg[0].language= default_charset_info->number;
keyinfo[0].seg[0].flag=(uint8) pack_seg;
keyinfo[0].seg[0].null_bit=0;
keyinfo[0].seg[0].null_pos=0;
@ -124,7 +124,7 @@ int main(int argc, char *argv[])
keyinfo[3].seg[0].start=0;
keyinfo[3].seg[0].length=reclength-(use_blob ? 8 : 0);
keyinfo[3].seg[0].type=HA_KEYTYPE_TEXT;
keyinfo[3].seg[0].language=MY_CHARSET_CURRENT;
keyinfo[3].seg[0].language=default_charset_info->number;
keyinfo[3].seg[0].flag=(uint8) pack_seg;
keyinfo[3].seg[0].null_bit=0;
keyinfo[3].seg[0].null_pos=0;
@ -135,7 +135,7 @@ int main(int argc, char *argv[])
keyinfo[4].seg[0].start=0;
keyinfo[4].seg[0].length=5;
keyinfo[4].seg[0].type=HA_KEYTYPE_TEXT;
keyinfo[4].seg[0].language=MY_CHARSET_CURRENT;
keyinfo[4].seg[0].language=default_charset_info->number;
keyinfo[4].seg[0].flag=0;
keyinfo[4].seg[0].null_bit=0;
keyinfo[4].seg[0].null_pos=0;
@ -146,7 +146,7 @@ int main(int argc, char *argv[])
keyinfo[5].seg[0].start=0;
keyinfo[5].seg[0].length=4;
keyinfo[5].seg[0].type=HA_KEYTYPE_TEXT;
keyinfo[5].seg[0].language=MY_CHARSET_CURRENT;
keyinfo[5].seg[0].language=default_charset_info->number;
keyinfo[5].seg[0].flag=pack_seg;
keyinfo[5].seg[0].null_bit=0;
keyinfo[5].seg[0].null_pos=0;

View File

@ -163,7 +163,7 @@ static struct my_option my_long_options[] =
"No help available.",
0, 0, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"backup", 'B',
"Make a backup of the .MYD file as 'filename-time.BAK'",
"Make a backup of the .MYD file as 'filename-time.BAK'.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.",
@ -209,7 +209,7 @@ static struct my_option my_long_options[] =
"Print statistics information about table that is checked.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"keys-used", 'k',
"Tell MyISAM to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts!",
"Tell MyISAM to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts.",
(gptr*) &check_param.keys_in_use,
(gptr*) &check_param.keys_in_use,
0, GET_ULL, REQUIRED_ARG, -1, 0, 0, 0, 0, 0},
@ -225,7 +225,7 @@ static struct my_option my_long_options[] =
"Can fix almost anything except unique keys that aren't unique.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"parallel-recover", 'p',
"Same as '-r' but creates all the keys in parallel",
"Same as '-r' but creates all the keys in parallel.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"safe-recover", 'o',
"Uses old recovery method; Slower than '-r' but can handle a couple of cases where '-r' reports that it can't fix the data file.",
@ -337,9 +337,9 @@ static void usage(void)
puts("Used without options all tables on the command will be checked for errors");
printf("Usage: %s [OPTIONS] tables[.MYI]\n", my_progname_short);
puts("\nGlobal options:\n\
-#, --debug=... Output debug log. Often this is 'd:t:o,filename'\n\
-#, --debug=... Output debug log. Often this is 'd:t:o,filename'.\n\
-?, --help Display this help and exit.\n\
-O, --set-variable var=option\n\
-O, --set-variable var=option.\n\
Change the value of a variable. Please note that\n\
this option is deprecated; you can set variables\n\
directly with '--variable-name=value'.\n\
@ -353,9 +353,9 @@ static void usage(void)
", they will be used\n\
in a round-robin fashion.\n\
-s, --silent Only print errors. One can use two -s to make\n\
myisamchk very silent\n\
myisamchk very silent.\n\
-v, --verbose Print more information. This can be used with\n\
--description and --check. Use many -v for more verbosity!\n\
--description and --check. Use many -v for more verbosity.\n\
-V, --version Print version and exit.\n\
-w, --wait Wait if table is locked.\n");
#ifdef DEBUG
@ -363,33 +363,33 @@ static void usage(void)
#endif
puts("Check options (check is the default action for myisamchk):\n\
-c, --check Check table for errors\n\
-c, --check Check table for errors.\n\
-e, --extend-check Check the table VERY throughly. Only use this in\n\
extreme cases as myisamchk should normally be able to\n\
find out if the table is ok even without this switch\n\
-F, --fast Check only tables that haven't been closed properly\n\
find out if the table is ok even without this switch.\n\
-F, --fast Check only tables that haven't been closed properly.\n\
-C, --check-only-changed\n\
Check only tables that have changed since last check\n\
Check only tables that have changed since last check.\n\
-f, --force Restart with '-r' if there are any errors in the table.\n\
States will be updated as with '--update-state'\n\
-i, --information Print statistics information about table that is checked\n\
States will be updated as with '--update-state'.\n\
-i, --information Print statistics information about table that is checked.\n\
-m, --medium-check Faster than extend-check, but only finds 99.99% of\n\
all errors. Should be good enough for most cases\n\
-U --update-state Mark tables as crashed if you find any errors\n\
-T, --read-only Don't mark table as checked\n");
all errors. Should be good enough for most cases.\n\
-U --update-state Mark tables as crashed if you find any errors.\n\
-T, --read-only Don't mark table as checked.\n");
puts("Repair options (When using '-r' or '-o') \n\
-B, --backup Make a backup of the .MYD file as 'filename-time.BAK'\n\
puts("Repair options (When using '-r' or '-o'):\n\
-B, --backup Make a backup of the .MYD file as 'filename-time.BAK'.\n\
--correct-checksum Correct checksum information for table.\n\
-D, --data-file-length=# Max length of data file (when recreating data\n\
file when it's full)\n\
file when it's full).\n\
-e, --extend-check Try to recover every possible row from the data file\n\
Normally this will also find a lot of garbage rows;\n\
Don't use this option if you are not totally desperate.\n\
-f, --force Overwrite old temporary files.\n\
-k, --keys-used=# Tell MyISAM to update only some specific keys. # is a\n\
bit mask of which keys to use. This can be used to\n\
get faster inserts!\n\
get faster inserts.\n\
-r, --recover Can fix almost anything except unique keys that aren't\n\
unique.\n\
-n, --sort-recover Forces recovering with sorting even if the temporary\n\
@ -397,17 +397,16 @@ static void usage(void)
-p, --parallel-recover\n\
Uses the same technique as '-r' and '-n', but creates\n\
all the keys in parallel, in different threads.\n\
THIS IS ALPHA CODE. USE AT YOUR OWN RISK!\n\
-o, --safe-recover Uses old recovery method; Slower than '-r' but can\n\
handle a couple of cases where '-r' reports that it\n\
can't fix the data file.\n\
--character-sets-dir=...\n\
Directory where character sets are\n\
Directory where character sets are.\n\
--set-character-set=name\n\
Change the character set used by the index\n\
Change the character set used by the index.\n\
-q, --quick Faster repair by not modifying the data file.\n\
One can give a second '-q' to force myisamchk to\n\
modify the original datafile in case of duplicate keys\n\
modify the original datafile in case of duplicate keys.\n\
-u, --unpack Unpack file packed with myisampack.\n\
");
@ -421,11 +420,11 @@ static void usage(void)
If no value is given, then sets the next auto_increment\n\
value to the highest used value for the auto key + 1.\n\
-S, --sort-index Sort index blocks. This speeds up 'read-next' in\n\
applications\n\
applications.\n\
-R, --sort-records=#\n\
Sort records according to an index. This makes your\n\
data much more localized and may speed up things\n\
(It may be VERY slow to do a sort the first time!)\n\
(It may be VERY slow to do a sort the first time!).\n\
-b, --block-search=#\n\
Find a record, a block at given offset belongs to.");

View File

@ -262,6 +262,7 @@ struct st_myisam_info {
int save_lastinx;
LIST open_list;
IO_CACHE rec_cache; /* When cacheing records */
uint preload_buff_size; /* When preloading indexes */
myf lock_wait; /* is 0 or MY_DONT_WAIT */
my_bool was_locked; /* Was locked in panic */
my_bool quick_mode;

View File

@ -235,12 +235,12 @@ enum options_mp {OPT_CHARSETS_DIR_MP=256};
static struct my_option my_long_options[] =
{
{"backup", 'b', "Make a backup of the table as table_name.OLD",
{"backup", 'b', "Make a backup of the table as table_name.OLD.",
(gptr*) &backup, (gptr*) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR_MP,
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'",
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
"Force packing of table even if it gets bigger or if tempfile exists.",

View File

@ -98,7 +98,7 @@ int run_test(const char *filename)
keyinfo[0].seg[i].length=key_length;
keyinfo[0].seg[i].null_bit= null_fields ? 2 : 0;
keyinfo[0].seg[i].null_pos=0;
keyinfo[0].seg[i].language=MY_CHARSET_CURRENT;
keyinfo[0].seg[i].language=default_charset_info->number;
}

View File

@ -96,7 +96,7 @@ int run_test(const char *filename)
keyinfo[0].seg[0].length=1; /* Spatial ignores it anyway */
keyinfo[0].seg[0].null_bit= null_fields ? 2 : 0;
keyinfo[0].seg[0].null_pos=0;
keyinfo[0].seg[0].language=MY_CHARSET_CURRENT;
keyinfo[0].seg[0].language=default_charset_info->number;
keyinfo[0].seg[0].bit_start=4; /* Long BLOB */

View File

@ -11,10 +11,12 @@ if [ x$1 = x"-bin" ]; then
bindir=../bin
BINARY_DIST=1
fix_bin=mysql-test
scriptdir=../bin
else
execdir=../sql
bindir=../client
fix_bin=.
scriptdir=../scripts
fi
vardir=var
@ -60,217 +62,11 @@ basedir=.
EXTRA_ARG="--language=../sql/share/english/"
fi
# Initialize variables
c_d="" i_d=""
c_h="" i_h=""
c_u="" i_u=""
c_f="" i_f=""
c_t="" c_c=""
c_hl="" c_hl=""
c_hc="" c_hc=""
c_clr="" c_clr=""
# Check for old tables
if test ! -f $mdata/db.frm
then
# mysqld --bootstrap wants one command/line
c_d="$c_d CREATE TABLE db ("
c_d="$c_d Host char(60) DEFAULT '' NOT NULL,"
c_d="$c_d Db char(64) DEFAULT '' NOT NULL,"
c_d="$c_d User char(16) DEFAULT '' NOT NULL,"
c_d="$c_d Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_d="$c_d PRIMARY KEY Host (Host,Db,User),"
c_d="$c_d KEY User (User)"
c_d="$c_d )"
c_d="$c_d comment='Database privileges';"
i_d="INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');"
fi
if test ! -f $mdata/host.frm
then
c_h="$c_h CREATE TABLE host ("
c_h="$c_h Host char(60) DEFAULT '' NOT NULL,"
c_h="$c_h Db char(64) DEFAULT '' NOT NULL,"
c_h="$c_h Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_h="$c_h PRIMARY KEY Host (Host,Db)"
c_h="$c_h )"
c_h="$c_h comment='Host privileges; Merged with database privileges';"
fi
if test ! -f $mdata/user.frm
then
c_u="$c_u CREATE TABLE user ("
c_u="$c_u Host char(60) binary DEFAULT '' NOT NULL,"
c_u="$c_u User char(16) binary DEFAULT '' NOT NULL,"
c_u="$c_u Password char(45) binary DEFAULT '' NOT NULL,"
c_u="$c_u Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u File_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
c_u="$c_u ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,"
c_u="$c_u ssl_cipher BLOB NOT NULL,"
c_u="$c_u x509_issuer BLOB NOT NULL,"
c_u="$c_u x509_subject BLOB NOT NULL,"
c_u="$c_u max_questions int(11) unsigned DEFAULT 0 NOT NULL,"
c_u="$c_u max_updates int(11) unsigned DEFAULT 0 NOT NULL,"
c_u="$c_u max_connections int(11) unsigned DEFAULT 0 NOT NULL,"
c_u="$c_u PRIMARY KEY Host (Host,User)"
c_u="$c_u )"
c_u="$c_u comment='Users and global privileges';"
i_u="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','','','','',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','','','','',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','','','','',0,0,0);
INSERT INTO user (host,user) values ('localhost','');
INSERT INTO user (host,user) values ('$hostname','');"
fi
if test ! -f $mdata/func.frm
then
c_f="$c_f CREATE TABLE func ("
c_f="$c_f name char(64) DEFAULT '' NOT NULL,"
c_f="$c_f ret tinyint(1) DEFAULT '0' NOT NULL,"
c_f="$c_f dl char(128) DEFAULT '' NOT NULL,"
c_f="$c_f type enum ('function','aggregate') NOT NULL,"
c_f="$c_f PRIMARY KEY (name)"
c_f="$c_f )"
c_f="$c_f comment='User defined functions';"
fi
if test ! -f $mdata/tables_priv.frm
then
c_t="$c_t CREATE TABLE tables_priv ("
c_t="$c_t Host char(60) DEFAULT '' NOT NULL,"
c_t="$c_t Db char(64) DEFAULT '' NOT NULL,"
c_t="$c_t User char(16) DEFAULT '' NOT NULL,"
c_t="$c_t Table_name char(60) DEFAULT '' NOT NULL,"
c_t="$c_t Grantor char(77) DEFAULT '' NOT NULL,"
c_t="$c_t Timestamp timestamp(14),"
c_t="$c_t Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,"
c_t="$c_t Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
c_t="$c_t PRIMARY KEY (Host,Db,User,Table_name),"
c_t="$c_t KEY Grantor (Grantor)"
c_t="$c_t )"
c_t="$c_t comment='Table privileges';"
fi
if test ! -f $mdata/columns_priv.frm
then
c_c="$c_c CREATE TABLE columns_priv ("
c_c="$c_c Host char(60) DEFAULT '' NOT NULL,"
c_c="$c_c Db char(64) DEFAULT '' NOT NULL,"
c_c="$c_c User char(16) DEFAULT '' NOT NULL,"
c_c="$c_c Table_name char(64) DEFAULT '' NOT NULL,"
c_c="$c_c Column_name char(64) DEFAULT '' NOT NULL,"
c_c="$c_c Timestamp timestamp(14),"
c_c="$c_c Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
c_c="$c_c PRIMARY KEY (Host,Db,User,Table_name,Column_name)"
c_c="$c_c )"
c_c="$c_c comment='Column privileges';"
fi
if test ! -f $mdata/help_topic.frm
then
c_hl="$c_hl CREATE TABLE help_topic ("
c_hl="$c_hl help_topic_id int unsigned not null auto_increment,"
c_hl="$c_hl name varchar(64) not null,"
c_hl="$c_hl description text not null,"
c_hl="$c_hl example text not null,"
c_hl="$c_hl url varchar(128) not null,"
c_hl="$c_hl primary key (help_topic_id),"
c_hl="$c_hl unique index (name)"
c_hl="$c_hl )"
c_hl="$c_hl comment='help topics';"
fi
if test ! -f $mdata/help_category.frm
then
c_clr="$c_clr CREATE TABLE help_category ("
c_clr="$c_clr help_category_id smallint unsigned not null auto_increment,"
c_clr="$c_clr name varchar(64) not null,"
c_clr="$c_clr url varchar(128) not null,"
c_clr="$c_clr primary key (help_category_id),"
c_clr="$c_clr unique index (name)"
c_clr="$c_clr )"
c_clr="$c_clr comment='help topics-categories relation';"
fi
if test ! -f $mdata/help_relation.frm
then
c_hc="$c_hc CREATE TABLE help_relation ("
c_hc="$c_hc help_topic_id int unsigned not null references help_topic,"
c_hc="$c_hc help_category_id smallint unsigned not null references help_category,"
c_hc="$c_hc primary key (help_category_id, help_topic_id),"
c_hc="$c_hc )"
c_hc="$c_hc comment='categories of help topics';"
fi
mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $EXTRA_ARG"
echo "running $mysqld_boot"
if $mysqld_boot << END_OF_DATA
use mysql;
$c_d
$i_d
$c_h
$i_h
$c_u
$i_u
$c_f
$i_f
$c_t
$c_c
$c_hl
$c_hc
$c_clr
END_OF_DATA
if $scriptdir/mysql_create_system_tables test $mdata $hostname | $mysqld_boot
then
exit 0
else

View File

@ -13,12 +13,15 @@ DB=test
DBPASSWD=
VERBOSE=""
USE_MANAGER=0
TZ=GMT-3; export TZ # for UNIX_TIMESTAMP tests to work
MY_TZ=GMT-3
TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work
#++
# Program Definitions
#--
LC_COLLATE=C
export LC_COLLATE
PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$PATH
MASTER_40_ARGS="--rpl-recovery-rank=1 --init-rpl-role=master"
@ -1163,9 +1166,18 @@ run_testcase ()
if [ -f $master_opt_file ] ;
then
EXTRA_MASTER_OPT=`$CAT $master_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
case "$EXTRA_MASTER_OPT" in
--timezone=*)
TZ=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--timezone=;;"`
export TZ
# Note that this must be set to space, not "" for test-reset to work
EXTRA_MASTER_OPT=" "
;;
esac
stop_master
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
start_master
TZ=$MY_TZ; export TZ
else
if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || [ -f $master_init_script ]
then

View File

@ -156,9 +156,9 @@ create table t1 (i int unsigned not null auto_increment primary key);
alter table t1 rename t2;
alter table t2 rename t1, add c char(10) comment "no comment";
show columns from t1;
Field Type Collation Null Key Default Extra
i int(10) unsigned NULL PRI NULL auto_increment
c char(10) latin1_swedish_ci YES NULL
Field Type Null Key Default Extra
i int(10) unsigned PRI NULL auto_increment
c char(10) YES NULL
drop table t1;
create table t1 (a int, b int);
insert into t1 values(1,100), (2,100), (3, 100);
@ -276,3 +276,8 @@ t1 0 a 1 a A 3 NULL NULL YES BTREE
t1 0 a 2 b A 300 NULL NULL YES BTREE
t1 1 b 1 b A 100 NULL NULL YES BTREE
drop table t1;
CREATE TABLE t1 (i int(10), index(i) );
ALTER TABLE t1 DISABLE KEYS;
INSERT DELAYED INTO t1 VALUES(1),(2),(3);
ALTER TABLE t1 ENABLE KEYS;
drop table t1;

View File

@ -6,26 +6,26 @@ Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_
count(*) 4 4 1 1 0 0 4.0000 0.0000 ENUM('4') NOT NULL
select * from t1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
test.t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
test.t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
select * from t1 procedure analyse(2);
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
t1.i 1 7 1 1 0 0 4.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL
t1.j 2 8 1 1 0 0 5.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL
t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
test.t1.i 1 7 1 1 0 0 4.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL
test.t1.j 2 8 1 1 0 0 5.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL
test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
create table t2 select * from t1 procedure analyse();
select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
test.t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
test.t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
drop table t1,t2;
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
id select_type table type possible_keys key key_len ref rows Extra

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