This commit is contained in:
joreland@mysql.com 2004-06-11 12:16:03 +02:00
commit eb863023bb
739 changed files with 14583 additions and 14187 deletions

View file

@ -16,15 +16,18 @@ arjen@bitbike.com
arjen@co3064164-a.bitbike.com
arjen@fred.bitbike.com
arjen@george.bitbike.com
autotest@mc01.ndb.mysql.com
bar@bar.intranet.mysql.r18.ru
bar@bar.mysql.r18.ru
bar@bar.udmsearch.izhnet.ru
bar@deer.(none)
bar@gw.udmsearch.izhnet.ru
bar@mysql.com
bell@laptop.sanja.is.com.ua
bell@sanja.is.com.ua
bk@admin.bk
bk@mysql.r18.ru
brian@avenger.(none)
brian@brian-akers-computer.local
carsten@tsort.bitbybit.dk
davida@isil.mysql.com
@ -76,6 +79,7 @@ jcole@sarvik.tfr.cafe.ee
jcole@tetra.spaceapes.com
joreland@mysql.com
jorge@linux.jorge.mysql.com
jplindst@t41.(none)
kaj@work.mysql.com
konstantin@mysql.com
kostja@oak.local

View file

@ -19,6 +19,7 @@ CFG=mysqlclient - Win32 Debug
!MESSAGE
!MESSAGE "mysqlclient - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "mysqlclient - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "mysqlclient - Win32 authent" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
@ -76,12 +77,38 @@ LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_debug\mysqlclient.lib"
!ELSEIF "$(CFG)" == "mysqlclient - Win32 authent"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "mysqlclient___Win32_authent"
# PROP BASE Intermediate_Dir "mysqlclient___Win32_authent"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "authent"
# PROP Intermediate_Dir "authent"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /D "MYSQL_CLIENT" /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /D "MYSQL_CLIENT" /D "NDEBUG" /D "CHECK_LICENSE" /D LICENSE=Commercial /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo /out:"..\lib_release\mysqlclient.lib"
# ADD LIB32 /nologo /out:"..\lib_authent\mysqlclient.lib"
!ENDIF
# Begin Target
# Name "mysqlclient - Win32 Release"
# Name "mysqlclient - Win32 Debug"
# Name "mysqlclient - Win32 authent"
# Begin Source File
SOURCE=..\mysys\array.c
@ -256,6 +283,8 @@ SOURCE=..\mysys\mf_iocache2.c
# ADD CPP /Od
!ELSEIF "$(CFG)" == "mysqlclient - Win32 authent"
!ENDIF
# End Source File

View file

@ -0,0 +1,9 @@
LIBRARY MYUDF
DESCRIPTION 'MySQL Sample for UDF'
VERSION 1.0
EXPORTS
metaphon
myfunc_double
myfunc_int
sequence
avgcost

View file

@ -0,0 +1,111 @@
# Microsoft Developer Studio Project File - Name="udf_example" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=udf_example - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "udf_example.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "udf_example.mak" CFG="udf_example - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "udf_example - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "udf_example - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "udf_example - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# 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 "UDF_EXAMPLE_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UDF_EXAMPLE_EXPORTS" /D "HAVE_DLOPEN" /YX /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"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
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 /dll /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 ..\..\lib\opt\strings.lib /nologo /dll /machine:I386 /out:"Release/myudf.dll"
!ELSEIF "$(CFG)" == "udf_example - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# 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 "UDF_EXAMPLE_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UDF_EXAMPLE_EXPORTS" /D "HAVE_DLOPEN" /YX /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"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
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 /dll /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 ..\..\lib\debug\strings.lib /nologo /dll /debug /machine:I386 /out:"Debug/myudf.dll" /pdbtype:sept
!ENDIF
# Begin Target
# Name "udf_example - Win32 Release"
# Name "udf_example - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\udf_example.cpp
# End Source File
# Begin Source File
SOURCE=.\udf_example.def
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View file

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "udf_example"=.\udf_example.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View file

@ -19,6 +19,7 @@ CFG=zlib - Win32 Debug
!MESSAGE
!MESSAGE "zlib - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "zlib - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "zlib - Win32 authent" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
@ -75,12 +76,38 @@ LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_debug\zlib.lib"
!ELSEIF "$(CFG)" == "zlib - Win32 authent"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "zlib___Win32_authent"
# PROP BASE Intermediate_Dir "zlib___Win32_authent"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "zlib___Win32_authent"
# PROP Intermediate_Dir "zlib___Win32_authent"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /D "DBUG_OFF" /D "_WINDOWS" /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /G6 /MT /W3 /O2 /D "DBUG_OFF" /D "_WINDOWS" /D "NDEBUG" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo /out:"..\lib_release\zlib.lib"
# ADD LIB32 /nologo /out:"..\lib_release\zlib.lib"
!ENDIF
# Begin Target
# Name "zlib - Win32 Release"
# Name "zlib - Win32 Debug"
# Name "zlib - Win32 authent"
# Begin Source File
SOURCE=.\adler32.c

View file

@ -115,6 +115,9 @@
/* Builds Example DB */
#undef HAVE_EXAMPLE_DB
/* Builds Archive Storage Engine */
#undef HAVE_ARCHIVE_DB
/* fp_except from ieeefp.h */
#undef HAVE_FP_EXCEPT
@ -203,6 +206,15 @@
/* If we want to have query cache */
#undef HAVE_QUERY_CACHE
/* Spatial extentions */
#undef HAVE_SPATIAL
/* RTree keys */
#undef HAVE_RTREE_KEYS
/* Access checks in embedded library */
#undef HAVE_EMBEDDED_PRIVILEGE_CONTROL
/* Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines
this with 8 arguments */
#undef HAVE_SOLARIS_STYLE_GETHOST
@ -269,6 +281,12 @@
/* mysql client protocoll version */
#undef PROTOCOL_VERSION
/* ndb version */
#undef NDB_VERSION_MAJOR
#undef NDB_VERSION_MINOR
#undef NDB_VERSION_BUILD
#undef NDB_VERSION_STATUS
/* Define if qsort returns void */
#undef QSORT_TYPE_IS_VOID

View file

@ -1332,6 +1332,36 @@ dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_EXAMPLE SECTION
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_ARCHIVEDB
dnl Sets HAVE_ARCHIVE_DB if --with-archive-storage-engine is used
dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_ARCHIVEDB], [
AC_ARG_WITH([archive-storage-engine],
[
--with-archive-storage-engine
Enable the Archive Storge Engine],
[archivedb="$withval"],
[archivedb=no])
AC_MSG_CHECKING([for archive storage engine])
case "$archivedb" in
yes )
AC_DEFINE(HAVE_ARCHIVE_DB)
AC_MSG_RESULT([yes])
[archivedb=yes]
;;
* )
AC_MSG_RESULT([no])
[archivedb=no]
;;
esac
])
dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_ARCHIVE SECTION
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl Macro: MYSQL_CHECK_NDBCLUSTER
dnl Sets HAVE_NDBCLUSTER_DB if --with-ndbcluster is used
@ -1348,6 +1378,11 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
--with-ndb-sci Include the NDB Cluster sci transporter],
[ndb_sci="$withval"],
[ndb_sci=no])
AC_ARG_WITH([ndb-test],
[
--with-ndb-test Include the NDB Cluster ndbapi test programs],
[ndb_test="$withval"],
[ndb_test=no])
AC_MSG_CHECKING([for NDB Cluster options])
AC_MSG_RESULT([])
@ -1376,6 +1411,17 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
;;
esac
have_ndb_test=no
case "$ndb_test" in
yes )
AC_MSG_RESULT([-- including ndbapi test programs])
have_ndb_test="yes"
;;
* )
AC_MSG_RESULT([-- not including ndbapi test programs])
;;
esac
AC_MSG_RESULT([done.])
])

View file

@ -394,7 +394,11 @@ static void write_header(FILE *sql_file, char *db_name)
mysql_get_server_info(&mysql_connection));
}
if (opt_set_charset)
fprintf(sql_file,"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=%s */;\n",default_charset);
fprintf(sql_file,
"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;"
"\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;"
"\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;"
"\n/*!40101 SET NAMES %s */;\n",default_charset);
if (!path)
{
fprintf(md_result_file,"\
@ -425,7 +429,9 @@ static void write_footer(FILE *sql_file)
}
if (opt_set_charset)
fprintf(sql_file,
"/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n");
"/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n"
"/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n"
"/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
fputs("\n", sql_file);
}
} /* write_footer */

View file

@ -187,7 +187,7 @@ typedef struct
*/
static char *subst_env_var(const char *cmd);
static int my_popen(const char *cmd, const char *mode);
static FILE *my_popen(const char *cmd, const char *mode);
#define popen(A,B) my_popen((A),(B))
#endif /* __NETWARE__ */
@ -3710,6 +3710,7 @@ static void get_replace_column(struct st_query *q)
static char *subst_env_var(const char *str)
{
char *result;
char *pos;
result= pos= my_malloc(MAX_QUERY, MYF(MY_FAE));
while (*str)
@ -3729,7 +3730,7 @@ static char *subst_env_var(const char *str)
*str && !isspace(*str) && *str != '\\' && *str != '/' &&
*str != '$';
str++)
*env_pos++ *str;
*env_pos++= *str;
*env_pos= 0;
if (!(subst= getenv(env_var)))
@ -3772,11 +3773,11 @@ static char *subst_env_var(const char *str)
#undef popen /* Remove wrapper */
int my_popen(const char *cmd, const char *mode __attribute__((unused)) t)
FILE *my_popen(const char *cmd, const char *mode __attribute__((unused)))
{
char *subst_cmd;
int res_file;
FILE *res_file;
subst_cmd= subst_env_var(cmd);
res_file= popen(subst_cmd, "r0");
my_free(subst_cmd, MYF(0));

View file

@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
AM_INIT_AUTOMAKE(mysql, 4.1.2-alpha)
AM_INIT_AUTOMAKE(mysql, 4.1.3-beta)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@ -12,6 +12,12 @@ DOT_FRM_VERSION=6
# See the libtool docs for information on how to do shared lib versions.
SHARED_LIB_VERSION=14:0:0
# ndb version
NDB_VERSION_MAJOR=3
NDB_VERSION_MINOR=5
NDB_VERSION_BUILD=0
NDB_VERSION_STATUS=beta
# Set all version vars based on $VERSION. How do we do this more elegant ?
# Remember that regexps needs to quote [ and ] since this is run through m4
MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[[a-z]]*-.*$||"`
@ -26,7 +32,7 @@ MYSQL_UNIX_ADDR_DEFAULT="/tmp/mysql.sock"
AVAILABLE_LANGUAGES="\
czech danish dutch english estonian french german greek hungarian \
italian japanese korean norwegian norwegian-ny polish portuguese \
romanian russian slovak spanish swedish ukrainian"
romanian russian serbian slovak spanish swedish ukrainian"
# Generate make rules for all error messages
AVAILABLE_LANGUAGES_ERRORS=
@ -64,6 +70,16 @@ AC_SUBST(AVAILABLE_LANGUAGES)
AC_SUBST(AVAILABLE_LANGUAGES_ERRORS)
AC_SUBST_FILE(AVAILABLE_LANGUAGES_ERRORS_RULES)
AC_SUBST([NDB_VERSION_MAJOR])
AC_SUBST([NDB_VERSION_MINOR])
AC_SUBST([NDB_VERSION_BUILD])
AC_SUBST([NDB_VERSION_STATUS])
AC_DEFINE_UNQUOTED([NDB_VERSION_MAJOR], [$NDB_VERSION_MAJOR])
AC_DEFINE_UNQUOTED([NDB_VERSION_MINOR], [$NDB_VERSION_MINOR])
AC_DEFINE_UNQUOTED([NDB_VERSION_BUILD], [$NDB_VERSION_BUILD])
AC_DEFINE_UNQUOTED([NDB_VERSION_STATUS], ["$NDB_VERSION_STATUS"])
# Canonicalize the configuration name.
SYSTEM_TYPE="$host_vendor-$host_os"
MACHINE_TYPE="$host_cpu"
@ -432,6 +448,15 @@ AC_SUBST(HOSTNAME)
AC_SUBST(PERL)
AC_SUBST(PERL5)
# for build ndb docs
AC_PATH_PROG(DOXYGEN, doxygen, no)
AC_PATH_PROG(PDFLATEX, pdflatex, no)
AC_PATH_PROG(MAKEINDEX, makeindex, no)
AC_SUBST(DOXYGEN)
AC_SUBST(PDFLATEX)
AC_SUBST(MAKEINDEX)
# Lock for PS
AC_PATH_PROG(PS, ps, ps)
AC_MSG_CHECKING("how to check if pid exists")
@ -767,7 +792,14 @@ AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT))
AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4, sem_init))
# For compress in zlib
MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib)
case $SYSTEM_TYPE in
*netware*)
AC_DEFINE(HAVE_COMPRESS)
;;
*)
MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib)
;;
esac
#--------------------------------------------------------------------
# Check for TCP wrapper support
@ -1614,19 +1646,15 @@ then
# Medium debug.
CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
#NDB_DEFS="-DNDB_RELEASE -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
NDB_DEFS="-DNDB_DEBUG -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
elif test "$with_debug" = "full"
then
# Full debug. Very slow in some cases
CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
NDB_DEFS="-DNDB_DEBUG -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
else
# Optimized version. No debug
CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS"
CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS"
NDB_DEFS="-DNDB_RELEASE -DUSE_EMULATED_JAM -DNDEBUG"
fi
# Force static compilation to avoid linking problems/get more speed
@ -2136,6 +2164,31 @@ then
AC_DEFINE(HAVE_QUERY_CACHE)
fi
AC_ARG_WITH(geometry,
[ --without-geometry Do not build geometry-related parts.],
[with_geometry=$withval],
[with_geometry=yes]
)
if test "$with_geometry" = "yes"
then
AC_DEFINE(HAVE_SPATIAL)
AC_DEFINE(HAVE_RTREE_KEYS)
fi
AC_ARG_WITH(embedded_privilege_control,
[ --with-embedded-privilege-control
Build parts to check user's privileges.
Only affects embedded library.],
[with_embedded_privilege_control=$withval],
[with_embedded_privilege_control=no]
)
if test "$with_embedded_privilege_control" = "yes"
then
AC_DEFINE(HAVE_EMBEDDED_PRIVILEGE_CONTROL)
fi
AC_ARG_WITH(extra-tools,
[ --without-extra-tools Skip building utilites in the tools directory.],
[with_tools=$withval],
@ -2624,6 +2677,7 @@ MYSQL_CHECK_ISAM
MYSQL_CHECK_BDB
MYSQL_CHECK_INNODB
MYSQL_CHECK_EXAMPLEDB
MYSQL_CHECK_ARCHIVEDB
MYSQL_CHECK_NDBCLUSTER
# If we have threads generate some library functions and test programs
@ -2838,86 +2892,22 @@ if test X"$have_ndbcluster" = Xyes
then
MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --with-ndbcluster"
CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS)"
if test "$with_debug" = "yes"
then
# Medium debug.
NDB_DEFS="-DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS) \$(NDB_CXXFLAGS_LOC) \$(NDB_CXXFLAGS_DEBUG_LOC)"
elif test "$with_debug" = "full"
then
NDB_DEFS="-DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS) \$(NDB_CXXFLAGS_LOC) \$(NDB_CXXFLAGS_DEBUG_LOC)"
else
NDB_DEFS="-DNDEBUG"
CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS) \$(NDB_CXXFLAGS_LOC) \$(NDB_CXXFLAGS_RELEASE_LOC)"
fi
fi
ndbbindir_root="\$(prefix)"
ndbbindir="\$(ndbbindir_root)/ndb/bin"
AC_SUBST(ndbbindir_root)
AC_SUBST(ndbbindir)
ndbtoolsdir_root="\$(prefix)"
ndbtoolsdir="\$(ndbtoolsdir_root)/ndb/tools"
AC_SUBST(ndbtoolsdir_root)
AC_SUBST(ndbtoolsdir)
ndblibdir_root="\$(prefix)"
ndblibdir="\$(ndblibdir_root)/ndb/lib"
AC_SUBST(ndblibdir_root)
AC_SUBST(ndblibdir)
ndbtestdir_root="\$(prefix)"
ndbtestdir="\$(ndbtestdir_root)/ndb/test"
AC_SUBST(ndbtestdir_root)
AC_SUBST(ndbtestdir)
ndbincludedir_root="\$(prefix)"
ndbincludedir="\$(ndbincludedir_root)/ndb/include"
AC_SUBST(ndbincludedir_root)
AC_SUBST(ndbincludedir)
ndbapiincludedir_root="\$(prefix)"
ndbapiincludedir="\$(ndbapiincludedir_root)/ndb/include/ndbapi"
AC_SUBST(ndbapiincludedir_root)
AC_SUBST(ndbapiincludedir)
mgmapiincludedir_root="\$(prefix)"
mgmapiincludedir="\$(mgmapiincludedir_root)/ndb/include/mgmapi"
AC_SUBST(mgmapiincludedir_root)
AC_SUBST(mgmapiincludedir)
NDB_UTIL_INCLUDES="-I\$(srcdir) -I\$(top_srcdir)/include -I\$(top_srcdir)/ndb/include \
-I\$(top_srcdir)/ndb/include/util \
-I\$(top_srcdir)/ndb/include/portlib \
-I\$(top_srcdir)/ndb/include/logger"
NDB_KERNEL_INCLUDES="\
-I\$(srcdir) -I\$(top_srcdir)/include -I\$(top_srcdir)/ndb/include \
-I\$(top_srcdir)/ndb/src/kernel/vm \
-I\$(top_srcdir)/ndb/src/kernel/error \
-I\$(top_srcdir)/ndb/src/kernel \
-I\$(top_srcdir)/ndb/include/kernel \
-I\$(top_srcdir)/ndb/include/transporter \
-I\$(top_srcdir)/ndb/include/debugger \
-I\$(top_srcdir)/ndb/include/mgmapi \
-I\$(top_srcdir)/ndb/include/mgmcommon \
-I\$(top_srcdir)/ndb/include/ndbapi \
-I\$(top_srcdir)/ndb/include/util \
-I\$(top_srcdir)/ndb/include/portlib \
-I\$(top_srcdir)/ndb/include/logger"
NDB_NDBAPI_INCLUDES="\
-I\$(srcdir) -I\$(top_srcdir)/include -I\$(top_srcdir)/ndb/include \
-I\$(top_srcdir)/ndb/include/kernel \
-I\$(top_srcdir)/ndb/include/transporter \
-I\$(top_srcdir)/ndb/include/debugger \
-I\$(top_srcdir)/ndb/include/mgmapi \
-I\$(top_srcdir)/ndb/include/mgmcommon \
-I\$(top_srcdir)/ndb/include/ndbapi \
-I\$(top_srcdir)/ndb/include/util \
-I\$(top_srcdir)/ndb/include/portlib \
-I\$(top_srcdir)/ndb/include/logger"
NDB_NDBAPITEST_INCLUDES="\
-I\$(srcdir) -I\$(top_srcdir)/include -I\$(top_srcdir)/ndb/include \
-I\$(top_srcdir)/ndb/include/ndbapi \
-I\$(top_srcdir)/ndb/include/util \
-I\$(top_srcdir)/ndb/include/portlib \
-I\$(top_srcdir)/ndb/test/include \
-I\$(top_srcdir)/ndb/include/mgmapi"
NDB_NDBAPICLIENT_INCLUDES="-I\$(top_srcdir)/ndb/include/ndbapi"
NDB_MGMAPICLIENT_INCLUDES="-I\$(top_srcdir)/ndb/include/mgmapi"
AC_SUBST(NDB_DEFS)
AC_SUBST(NDB_UTIL_INCLUDES)
AC_SUBST(NDB_UTIL_INCLUDES)
AC_SUBST(NDB_KERNEL_INCLUDES)
AC_SUBST(NDB_NDBAPI_INCLUDES)
AC_SUBST(NDB_NDBAPITEST_INCLUDES)
AC_SUBST(NDB_NDBAPICLIENT_INCLUDES)
AC_SUBST(NDB_MGMAPICLIENT_INCLUDES)
AC_SUBST([NDB_DEFS])
ndb_transporter_opt_objs=""
if test X"$have_ndb_shm" = Xyes
@ -2928,27 +2918,27 @@ if test X"$have_ndb_sci" = Xyes
then
ndb_transporter_opt_objs="$(ndb_transporter_opt_objs) SCI_Transporter.lo"
fi
AC_SUBST(ndb_transporter_opt_objs)
AC_SUBST([ndb_transporter_opt_objs])
#NDB_TYPE_COMMON="include \$(top_srcdir)/ndb/config/common.mk.am"
#NDB_TYPE_NDBAPI="include \$(top_srcdir)/ndb/config/type_ndbapi.mk.am"
#NDB_TYPE_NDBAPI="include \$(top_srcdir)/ndb/config/type_ndbapitest.mk.am"
#NDB_TYPE_KERNEL="include \$(top_srcdir)/ndb/config/type_kernel.mk.am"
#NDB_TYPE_UTIL="include \$(top_srcdir)/ndb/config/type_util.mk.am"
#AC_SUBST(NDB_TYPE_COMMON)
#AC_SUBST(NDB_TYPE_NDBAPI)
#AC_SUBST(NDB_TYPE_NDBAPITEST)
#AC_SUBST(NDB_TYPE_KERNEL)
#AC_SUBST(NDB_TYPE_UTIL)
ndb_bin_am_ldflags="-static"
if test X"$have_ndb_test" = Xyes
then
ndb_opt_test_subdirs="test"
ndb_bin_am_ldflags=""
fi
AC_SUBST([ndb_bin_am_ldflags])
AC_SUBST([ndb_opt_test_subdirs])
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
# Output results
AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile dnl
ndb/Makefile ndb/src/Makefile ndb/src/common/Makefile dnl
ndb/docs/Makefile dnl
ndb/Makefile ndb/include/Makefile dnl
ndb/src/Makefile ndb/src/common/Makefile dnl
ndb/tools/Makefile dnl
ndb/src/common/debugger/Makefile ndb/src/common/debugger/signaldata/Makefile dnl
ndb/src/common/portlib/Makefile ndb/src/common/portlib/unix/Makefile dnl
ndb/src/common/portlib/Makefile dnl
ndb/src/common/util/Makefile dnl
ndb/src/common/logger/Makefile dnl
ndb/src/common/transporter/Makefile dnl
@ -2975,7 +2965,6 @@ AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile dnl
ndb/src/kernel/blocks/grep/Makefile dnl
ndb/src/kernel/blocks/dbtux/Makefile dnl
ndb/src/kernel/vm/Makefile dnl
ndb/src/kernel/ndb-main/Makefile dnl
ndb/src/mgmapi/Makefile dnl
ndb/src/ndbapi/Makefile dnl
ndb/src/mgmsrv/Makefile dnl

View file

@ -197,7 +197,7 @@ int main(int argc,char *argv[])
for (code=1 ; code < sys_nerr ; code++)
{
if (sys_errlist[code][0])
{ /* Skipp if no error-text */
{ /* Skip if no error-text */
printf("%3d = %s\n",code,sys_errlist[code]);
}
}

View file

@ -236,7 +236,7 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
key+=seg->length;
if (seg->null_bit)
{
key++; /* Skipp null byte */
key++; /* Skip null byte */
if (*pos) /* Found null */
{
nr^= (nr << 1) | 1;

View file

@ -200,6 +200,7 @@ typedef struct charset_info_st
const char *csname;
const char *name;
const char *comment;
const char *tailoring;
uchar *ctype;
uchar *to_lower;
uchar *to_upper;

View file

@ -1194,6 +1194,8 @@ do { doubleget_union _tmp; \
#define MYSQL_UNIVERSAL_CLIENT_CHARSET MYSQL_DEFAULT_CHARSET_NAME
#endif
#define HAVE_SPATIAL
#define HAVE_RTREE_KEYS
#if defined(EMBEDDED_LIBRARY) && !defined(HAVE_EMBEDDED_PRIVILEGE_CONTROL)
#define NO_EMBEDDED_ACCESS_CHECKS
#endif
#endif /* my_global_h */

View file

@ -21,6 +21,10 @@
better compression
*/
/* these two are for uniformity */
#define mi_sint1korr(A) (int8)(*A)
#define mi_uint1korr(A) (uint8)(*A)
#define mi_sint2korr(A) (int16) (((int16) ((uchar) (A)[1])) +\
((int16) ((int16) (A)[0]) << 8))
#define mi_sint3korr(A) ((int32) ((((uchar) (A)[0]) & 128) ? \
@ -75,6 +79,9 @@
(((uint32) ((uchar) (A)[0])) << 24))) <<\
32))
/* This one is for uniformity */
#define mi_int1store(T,A) *((uchar*)(T))= (uchar) (A)
#define mi_int2store(T,A) { uint def_temp= (uint) (A) ;\
*((uchar*) ((T)+1))= (uchar)(def_temp); \
*((uchar*) ((T)+0))= (uchar)(def_temp >> 8); }

View file

@ -77,7 +77,6 @@ extern char *mysql_unix_port;
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR)
#define HAVE_DEPRECATED_411_API 1
typedef struct st_mysql_field {
char *name; /* Name of column */
@ -336,7 +335,7 @@ typedef struct st_mysql_parameters
int STDCALL mysql_server_init(int argc, char **argv, char **groups);
void STDCALL mysql_server_end(void);
MYSQL_PARAMETERS *STDCALL mysql_get_parameters();
MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void);
/*
Set up and bring down a thread; these function should be called
@ -711,6 +710,7 @@ void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset);
my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt);
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt);
unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt);
my_bool STDCALL mysql_commit(MYSQL * mysql);
my_bool STDCALL mysql_rollback(MYSQL * mysql);

View file

@ -681,7 +681,7 @@ dict_init(void)
rw_lock_create(&dict_operation_lock);
rw_lock_set_level(&dict_operation_lock, SYNC_DICT_OPERATION);
dict_foreign_err_file = tmpfile();
dict_foreign_err_file = os_file_create_tmpfile();
mutex_create(&dict_foreign_err_mutex);
mutex_set_level(&dict_foreign_err_mutex, SYNC_ANY_LATCH);
}

View file

@ -1409,6 +1409,7 @@ fil_read_flushed_lsn_and_arch_log_no(
byte* buf;
byte* buf2;
dulint flushed_lsn;
buf2 = ut_malloc(2 * UNIV_PAGE_SIZE);
/* Align the memory for a possible read from a raw device */
buf = ut_align(buf2, UNIV_PAGE_SIZE);
@ -1852,8 +1853,6 @@ try_again:
success = os_file_delete(path);
}
mem_free(path);
if (success) {
#ifndef UNIV_HOTBACKUP
/* Write a log record about the deletion of the .ibd
@ -1869,9 +1868,13 @@ try_again:
fil_op_write_log(MLOG_FILE_DELETE, id, path, NULL, &mtr);
mtr_commit(&mtr);
#endif
mem_free(path);
return(TRUE);
}
mem_free(path);
return(FALSE);
}
@ -2148,6 +2151,7 @@ fil_create_new_single_table_tablespace(
os_file_t file;
ibool ret;
ulint err;
byte* buf2;
byte* page;
ibool success;
char* path;
@ -2191,12 +2195,14 @@ fil_create_new_single_table_tablespace(
return(DB_ERROR);
}
page = ut_malloc(UNIV_PAGE_SIZE);
buf2 = ut_malloc(2 * UNIV_PAGE_SIZE);
/* Align the memory for file i/o if we might have O_DIRECT set */
page = ut_align(buf2, UNIV_PAGE_SIZE);
ret = os_file_set_size(path, file, size * UNIV_PAGE_SIZE, 0);
if (!ret) {
ut_free(page);
ut_free(buf2);
os_file_close(file);
os_file_delete(path);
@ -2211,7 +2217,7 @@ fil_create_new_single_table_tablespace(
/* printf("Creating tablespace %s id %lu\n", path, *space_id); */
if (*space_id == ULINT_UNDEFINED) {
ut_free(page);
ut_free(buf2);
error_exit:
os_file_close(file);
os_file_delete(path);
@ -2237,7 +2243,7 @@ fil_create_new_single_table_tablespace(
ret = os_file_write(path, file, page, 0, 0, UNIV_PAGE_SIZE);
ut_free(page);
ut_free(buf2);
if (!ret) {
fprintf(stderr,
@ -2308,6 +2314,7 @@ fil_reset_too_high_lsns(
os_file_t file;
char* filepath;
byte* page;
byte* buf2;
dulint flush_lsn;
ulint space_id;
ib_longlong file_size;
@ -2320,14 +2327,16 @@ fil_reset_too_high_lsns(
file = os_file_create_simple_no_error_handling(filepath, OS_FILE_OPEN,
OS_FILE_READ_WRITE, &success);
if (!success) {
ut_free(filepath);
mem_free(filepath);
return(FALSE);
}
/* Read the first page of the tablespace */
page = ut_malloc(UNIV_PAGE_SIZE);
buf2 = ut_malloc(2 * UNIV_PAGE_SIZE);
/* Align the memory for file i/o if we might have O_DIRECT set */
page = ut_align(buf2, UNIV_PAGE_SIZE);
success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);
if (!success) {
@ -2414,8 +2423,8 @@ fil_reset_too_high_lsns(
success = os_file_flush(file);
func_exit:
os_file_close(file);
ut_free(page);
ut_free(filepath);
ut_free(buf2);
mem_free(filepath);
return(success);
}
@ -2440,6 +2449,7 @@ fil_open_single_table_tablespace(
os_file_t file;
char* filepath;
ibool success;
byte* buf2;
byte* page;
ulint space_id;
ibool ret = TRUE;
@ -2463,14 +2473,16 @@ fil_open_single_table_tablespace(
"InnoDB: You can look from section 15.1 of http://www.innodb.com/ibman.html\n"
"InnoDB: how to resolve the issue.\n");
ut_free(filepath);
mem_free(filepath);
return(FALSE);
}
/* Read the first page of the tablespace */
page = ut_malloc(UNIV_PAGE_SIZE);
buf2 = ut_malloc(2 * UNIV_PAGE_SIZE);
/* Align the memory for file i/o if we might have O_DIRECT set */
page = ut_align(buf2, UNIV_PAGE_SIZE);
success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);
@ -2507,8 +2519,8 @@ fil_open_single_table_tablespace(
fil_node_create(filepath, 0, space_id, FALSE);
func_exit:
os_file_close(file);
ut_free(page);
ut_free(filepath);
ut_free(buf2);
mem_free(filepath);
return(ret);
}
@ -2516,7 +2528,7 @@ func_exit:
#ifdef UNIV_HOTBACKUP
/***********************************************************************
Allocates a file name for an old version of a single-table tablespace.
The string must be freed by caller with mem_free(). */
The string must be freed by caller with mem_free()! */
static
char*
fil_make_ibbackup_old_name(
@ -2526,7 +2538,7 @@ fil_make_ibbackup_old_name(
{
static const char suffix[] = "_ibbackup_old_vers_";
ulint len = strlen(name);
char* path = ut_malloc(len + (15 + sizeof suffix));
char* path = mem_alloc(len + (15 + sizeof suffix));
memcpy(path, name, len);
memcpy(path + len, suffix, (sizeof suffix) - 1);
@ -2549,6 +2561,7 @@ fil_load_single_table_tablespace(
os_file_t file;
char* filepath;
ibool success;
byte* buf2;
byte* page;
ulint space_id;
ulint size_low;
@ -2557,7 +2570,7 @@ fil_load_single_table_tablespace(
#ifdef UNIV_HOTBACKUP
fil_space_t* space;
#endif
filepath = ut_malloc(strlen(dbname) + strlen(filename)
filepath = mem_alloc(strlen(dbname) + strlen(filename)
+ strlen(fil_path_to_mysql_datadir) + 3);
sprintf(filepath, "%s/%s/%s", fil_path_to_mysql_datadir, dbname,
@ -2572,11 +2585,30 @@ fil_load_single_table_tablespace(
fprintf(stderr,
"InnoDB: Error: could not open single-table tablespace file\n"
"InnoDB: %s!\n", filepath);
"InnoDB: %s!\n"
"InnoDB: We do not continue crash recovery, because the table will become\n"
"InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.\n"
"InnoDB: To fix the problem and start mysqld:\n"
"InnoDB: 1) If there is a permission problem in the file and mysqld cannot\n"
"InnoDB: open the file, you should modify the permissions.\n"
"InnoDB: 2) If the table is not needed, or you can restore it from a backup,\n"
"InnoDB: then you can remove the .ibd file, and InnoDB will do a normal\n"
"InnoDB: crash recovery and ignore that table.\n"
"InnoDB: 3) If the file system or the disk is broken, and you cannot remove\n"
"InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf\n"
"InnoDB: and force InnoDB to continue crash recovery here.\n", filepath);
ut_free(filepath);
mem_free(filepath);
return;
if (srv_force_recovery > 0) {
fprintf(stderr,
"InnoDB: innodb_force_recovery was set to %lu. Continuing crash recovery\n"
"InnoDB: even though we cannot access the .ibd file of this table.\n",
srv_force_recovery);
return;
}
exit(1);
}
success = os_file_get_size(file, &size_low, &size_high);
@ -2587,14 +2619,36 @@ fil_load_single_table_tablespace(
fprintf(stderr,
"InnoDB: Error: could not measure the size of single-table tablespace file\n"
"InnoDB: %s!\n", filepath);
"InnoDB: %s!\n"
"InnoDB: We do not continue crash recovery, because the table will become\n"
"InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.\n"
"InnoDB: To fix the problem and start mysqld:\n"
"InnoDB: 1) If there is a permission problem in the file and mysqld cannot\n"
"InnoDB: access the file, you should modify the permissions.\n"
"InnoDB: 2) If the table is not needed, or you can restore it from a backup,\n"
"InnoDB: then you can remove the .ibd file, and InnoDB will do a normal\n"
"InnoDB: crash recovery and ignore that table.\n"
"InnoDB: 3) If the file system or the disk is broken, and you cannot remove\n"
"InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf\n"
"InnoDB: and force InnoDB to continue crash recovery here.\n", filepath);
os_file_close(file);
ut_free(filepath);
mem_free(filepath);
return;
if (srv_force_recovery > 0) {
fprintf(stderr,
"InnoDB: innodb_force_recovery was set to %lu. Continuing crash recovery\n"
"InnoDB: even though we cannot access the .ibd file of this table.\n",
srv_force_recovery);
return;
}
exit(1);
}
/* TODO: What to do in other cases where we cannot access an .ibd
file during a crash recovery? */
/* Every .ibd file is created >= 4 pages in size. Smaller files
cannot be ok. */
@ -2607,14 +2661,16 @@ fil_load_single_table_tablespace(
(ulong) size_high,
(ulong) size_low, (ulong) (4 * UNIV_PAGE_SIZE));
os_file_close(file);
ut_free(filepath);
mem_free(filepath);
return;
}
#endif
/* Read the first page of the tablespace if the size big enough */
page = ut_malloc(UNIV_PAGE_SIZE);
buf2 = ut_malloc(2 * UNIV_PAGE_SIZE);
/* Align the memory for file i/o if we might have O_DIRECT set */
page = ut_align(buf2, UNIV_PAGE_SIZE);
if (size >= FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);
@ -2650,9 +2706,9 @@ fil_load_single_table_tablespace(
new_path = fil_make_ibbackup_old_name(filepath);
ut_a(os_file_rename(filepath, new_path));
ut_free(page);
ut_free(filepath);
ut_free(new_path);
ut_free(buf2);
mem_free(filepath);
mem_free(new_path);
return;
}
@ -2686,9 +2742,9 @@ fil_load_single_table_tablespace(
ut_a(os_file_rename(filepath, new_path));
ut_free(page);
ut_free(filepath);
ut_free(new_path);
ut_free(buf2);
mem_free(filepath);
mem_free(new_path);
return;
}
@ -2707,8 +2763,8 @@ fil_load_single_table_tablespace(
fil_node_create(filepath, 0, space_id, FALSE);
func_exit:
os_file_close(file);
ut_free(page);
ut_free(filepath);
ut_free(buf2);
mem_free(filepath);
}
/************************************************************************
@ -2726,7 +2782,7 @@ fil_load_single_table_tablespaces(void)
{
int ret;
char* dbpath = NULL;
ulint dbpath_len = 0;
ulint dbpath_len = 100;
os_file_dir_t dir;
os_file_dir_t dbdir;
os_file_stat_t dbinfo;
@ -2741,7 +2797,7 @@ fil_load_single_table_tablespaces(void)
return(DB_ERROR);
}
dbpath = ut_malloc(dbpath_len);
dbpath = mem_alloc(dbpath_len);
/* Scan all directories under the datadir. They are the database
directories of MySQL. */
@ -2765,10 +2821,10 @@ fil_load_single_table_tablespaces(void)
+ strlen (dbinfo.name) + 2;
if (len > dbpath_len) {
dbpath_len = len;
if (!dbpath) {
dbpath = mem_alloc(dbpath_len);
}
else {
} else {
dbpath = mem_realloc(dbpath, dbpath_len,
__FILE__, __LINE__);
}
@ -2822,9 +2878,7 @@ next_datadir_item:
dir, &dbinfo);
}
if (dbpath) {
ut_free(dbpath);
}
mem_free(dbpath);
/* At the end of directory we should get 1 as the return value, -1
if there was an error */
@ -3239,7 +3293,7 @@ fil_extend_space_to_desired_size(
/************************************************************************
Extends all tablespaces to the size stored in the space header. During the
ibbackup --apply-log phase we extended the spaces on-demand so that log records
could be appllied, but that may have left spaces still too small compared to
could be applied, but that may have left spaces still too small compared to
the size stored in the space header. */
void

View file

@ -169,6 +169,13 @@ void
os_io_init_simple(void);
/*===================*/
/***************************************************************************
Creates a temporary file. In case of error, causes abnormal termination. */
FILE*
os_file_create_tmpfile(void);
/*========================*/
/* out: temporary file handle (never NULL) */
/***************************************************************************
The os_file_opendir() function opens a directory stream corresponding to the
directory named by the dirname argument. The directory stream is positioned
at the first entry. In both Unix and Windows we automatically skip the '.'

View file

@ -558,6 +558,9 @@ struct row_prebuilt_struct {
dtuple_t* clust_ref; /* prebuilt dtuple used in
sel/upd/del */
ulint select_lock_type;/* LOCK_NONE, LOCK_S, or LOCK_X */
ulint stored_select_lock_type;/* inside LOCK TABLES, either
LOCK_S or LOCK_X depending on the lock
type */
ulint mysql_row_len; /* length in bytes of a row in the
MySQL format */
ulint n_rows_fetched; /* number of rows fetched after

View file

@ -510,7 +510,7 @@ lock_sys_create(
/* hash_create_mutexes(lock_sys->rec_hash, 2, SYNC_REC_LOCK); */
lock_latest_err_file = tmpfile();
lock_latest_err_file = os_file_create_tmpfile();
}
/*************************************************************************

View file

@ -311,14 +311,11 @@ os_file_handle_error(
/*=================*/
/* out: TRUE if we should retry the
operation */
os_file_t file, /* in: file pointer */
const char* name, /* in: name of a file or NULL */
const char* operation)/* in: operation */
{
ulint err;
UT_NOT_USED(file);
err = os_file_get_last_error(FALSE);
if (err == OS_FILE_DISK_FULL) {
@ -387,22 +384,19 @@ os_file_lock(
/*=========*/
/* out: 0 on success */
int fd, /* in: file descriptor */
const char* name, /* in: file name */
uint lock_type) /* in: lock_type */
const char* name) /* in: file name */
{
struct flock lk;
lk.l_type = lock_type;
lk.l_type = F_WRLCK;
lk.l_whence = SEEK_SET;
lk.l_start = lk.l_len = 0;
if (fcntl(fd, F_SETLK, &lk) == -1) {
fprintf(stderr,
"InnoDB: Unable to lock %s with lock %d, error: %d",
name, lock_type, errno);
perror (": fcntl");
"InnoDB: Unable to lock %s, error: %d", name, errno);
close(fd);
return(-1);
}
return 0;
return(0);
}
#endif /* USE_FILE_LOCK */
@ -484,6 +478,25 @@ os_io_init_simple(void)
}
}
/***************************************************************************
Creates a temporary file. In case of error, causes abnormal termination. */
FILE*
os_file_create_tmpfile(void)
/*========================*/
/* out: temporary file handle (never NULL) */
{
FILE* file = tmpfile();
if (file == NULL) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: unable to create temporary file\n",
stderr);
os_file_handle_error(NULL, "tmpfile");
ut_error;
}
return(file);
}
/***************************************************************************
The os_file_opendir() function opens a directory stream corresponding to the
directory named by the dirname argument. The directory stream is positioned
@ -526,7 +539,7 @@ os_file_opendir(
if (dir == INVALID_HANDLE_VALUE) {
if (error_is_fatal) {
os_file_handle_error(NULL, dirname, "opendir");
os_file_handle_error(dirname, "opendir");
}
return(NULL);
@ -537,7 +550,7 @@ os_file_opendir(
dir = opendir(dirname);
if (dir == NULL && error_is_fatal) {
os_file_handle_error(0, dirname, "opendir");
os_file_handle_error(dirname, "opendir");
}
return(dir);
@ -720,7 +733,7 @@ os_file_create_directory(
if (!(rcode != 0 ||
(GetLastError() == ERROR_FILE_EXISTS && !fail_if_exists))) {
/* failure */
os_file_handle_error(NULL, pathname, "CreateDirectory");
os_file_handle_error(pathname, "CreateDirectory");
return(FALSE);
}
@ -733,7 +746,7 @@ os_file_create_directory(
if (!(rcode == 0 || (errno == EEXIST && !fail_if_exists))) {
/* failure */
os_file_handle_error(0, pathname, "mkdir");
os_file_handle_error(pathname, "mkdir");
return(FALSE);
}
@ -812,7 +825,7 @@ try_again:
if (file == INVALID_HANDLE_VALUE) {
*success = FALSE;
retry = os_file_handle_error(file, name,
retry = os_file_handle_error(name,
create_mode == OS_FILE_OPEN ?
"open" : "create");
if (retry) {
@ -862,14 +875,15 @@ try_again:
if (file == -1) {
*success = FALSE;
retry = os_file_handle_error(file, name,
retry = os_file_handle_error(name,
create_mode == OS_FILE_OPEN ?
"open" : "create");
if (retry) {
goto try_again;
}
#ifdef USE_FILE_LOCK
} else if (os_file_lock(file, name, F_WRLCK)) {
} else if (access_type == OS_FILE_READ_WRITE
&& os_file_lock(file, name)) {
*success = FALSE;
file = -1;
#endif
@ -980,7 +994,8 @@ os_file_create_simple_no_error_handling(
if (file == -1) {
*success = FALSE;
#ifdef USE_FILE_LOCK
} else if (os_file_lock(file, name, F_WRLCK)) {
} else if (access_type == OS_FILE_READ_WRITE
&& os_file_lock(file, name)) {
*success = FALSE;
file = -1;
#endif
@ -1102,7 +1117,7 @@ try_again:
if (file == INVALID_HANDLE_VALUE) {
*success = FALSE;
retry = os_file_handle_error(file, name,
retry = os_file_handle_error(name,
create_mode == OS_FILE_CREATE ?
"create" : "open");
if (retry) {
@ -1187,14 +1202,15 @@ try_again:
if (file == -1) {
*success = FALSE;
retry = os_file_handle_error(file, name,
retry = os_file_handle_error(name,
create_mode == OS_FILE_CREATE ?
"create" : "open");
if (retry) {
goto try_again;
}
#ifdef USE_FILE_LOCK
} else if (os_file_lock(file, name, F_WRLCK)) {
} else if (create_mode != OS_FILE_OPEN_RAW
&& os_file_lock(file, name)) {
*success = FALSE;
file = -1;
#endif
@ -1258,7 +1274,7 @@ loop:
ret = unlink((const char*)name);
if (ret != 0 && errno != ENOENT) {
os_file_handle_error(0, name, "delete");
os_file_handle_error(name, "delete");
return(FALSE);
}
@ -1320,7 +1336,7 @@ loop:
ret = unlink((const char*)name);
if (ret != 0) {
os_file_handle_error(0, name, "delete");
os_file_handle_error(name, "delete");
return(FALSE);
}
@ -1350,7 +1366,7 @@ os_file_rename(
return(TRUE);
}
os_file_handle_error(NULL, oldpath, "rename");
os_file_handle_error(oldpath, "rename");
return(FALSE);
#else
@ -1359,7 +1375,7 @@ os_file_rename(
ret = rename((const char*)oldpath, (const char*)newpath);
if (ret != 0) {
os_file_handle_error(0, oldpath, "rename");
os_file_handle_error(oldpath, "rename");
return(FALSE);
}
@ -1389,19 +1405,16 @@ os_file_close(
return(TRUE);
}
os_file_handle_error(file, NULL, "close");
os_file_handle_error(NULL, "close");
return(FALSE);
#else
int ret;
#ifdef USE_FILE_LOCK
(void) os_file_lock(file, "unknown", F_UNLCK);
#endif
ret = close(file);
if (ret == -1) {
os_file_handle_error(file, NULL, "close");
os_file_handle_error(NULL, "close");
return(FALSE);
}
@ -1434,9 +1447,6 @@ os_file_close_no_error_handling(
#else
int ret;
#ifdef USE_FILE_LOCK
(void) os_file_lock(file, "unknown", F_UNLCK);
#endif
ret = close(file);
if (ret == -1) {
@ -1657,7 +1667,7 @@ os_file_flush(
return(TRUE);
}
os_file_handle_error(file, NULL, "flush");
os_file_handle_error(NULL, "flush");
/* It is a fatal error if a file flush does not succeed, because then
the database can get corrupt on disk */
@ -1692,7 +1702,7 @@ os_file_flush(
fprintf(stderr,
" InnoDB: Error: the OS said file flush did not succeed\n");
os_file_handle_error(file, NULL, "flush");
os_file_handle_error(NULL, "flush");
/* It is a fatal error if a file flush does not succeed, because then
the database can get corrupt on disk */
@ -1952,7 +1962,7 @@ try_again:
#ifdef __WIN__
error_handling:
#endif
retry = os_file_handle_error(file, NULL, "read");
retry = os_file_handle_error(NULL, "read");
if (retry) {
goto try_again;
@ -2331,21 +2341,24 @@ os_file_dirname(
pathname */
const char* path) /* in: pathname */
{
/* find the offset of the last slash */
/* Find the offset of the last slash */
const char* last_slash = strrchr(path, OS_FILE_PATH_SEPARATOR);
if (!last_slash) {
/* no slash in the path, return "." */
/* No slash in the path, return "." */
return(mem_strdup("."));
}
/* ok, there is a slash */
/* Ok, there is a slash */
if (last_slash == path) {
/* last slash is the first char of the path */
return(mem_strdup("/"));
}
/* non-trivial directory component */
/* Non-trivial directory component */
return(mem_strdupl(path, last_slash - path));
}
@ -2367,23 +2380,26 @@ os_file_create_subdirs_if_needed(
if (strlen(subdir) == 1
&& (*subdir == OS_FILE_PATH_SEPARATOR || *subdir == '.')) {
/* subdir is root or cwd, nothing to do */
ut_free(subdir);
mem_free(subdir);
return(TRUE);
}
/* test if subdir exists */
/* Test if subdir exists */
success = os_file_status(subdir, &subdir_exists, &type);
if (success && !subdir_exists) {
/* subdir does not exist, create it */
success = os_file_create_subdirs_if_needed(subdir);
if (!success) {
ut_free(subdir);
mem_free(subdir);
return(FALSE);
}
success = os_file_create_directory(subdir, FALSE);
}
ut_free(subdir);
mem_free(subdir);
return(success);
}
@ -3163,7 +3179,7 @@ try_again:
os_aio_array_free_slot(array, slot);
retry = os_file_handle_error(file, name,
retry = os_file_handle_error(name,
type == OS_FILE_READ ? "aio read" : "aio write");
if (retry) {
@ -3263,7 +3279,7 @@ os_aio_windows_handle(
ut_a(TRUE == os_file_flush(slot->file));
}
} else {
os_file_handle_error(slot->file, slot->name, "Windows aio");
os_file_handle_error(slot->name, "Windows aio");
ret_val = FALSE;
}

View file

@ -397,6 +397,7 @@ row_create_prebuilt(
prebuilt->clust_pcur = btr_pcur_create_for_mysql();
prebuilt->select_lock_type = LOCK_NONE;
prebuilt->stored_select_lock_type = 99999999;
prebuilt->sel_graph = NULL;

View file

@ -430,7 +430,7 @@ uint _nisam_rec_pack(N_INFO *info, register byte *to, register const byte *from)
to+=length+blob->length;
}
blob++;
from+=sizeof(char*); /* Skipp blob-pointer */
from+=sizeof(char*); /* Skip blob-pointer */
}
else if (type == FIELD_SKIP_ZERO)
{
@ -633,7 +633,7 @@ uint _nisam_rec_unpack(register N_INFO *info, register byte *to, byte *from,
if ((type = (enum en_fieldtype) rec->base.type) != FIELD_NORMAL)
{
if (type == FIELD_ZERO)
continue; /* Skipp this */
continue; /* Skip this */
if (flag & bit)
{
if (type == FIELD_BLOB)
@ -747,7 +747,7 @@ uint _calc_blob_length(uint length, const byte *pos)
return (uint) (unsigned short) j;
}
#ifdef MSDOS
break; /* skipp microsoft warning */
break; /* skip microsoft warning */
#endif
case 3:
return uint3korr(pos);

View file

@ -858,7 +858,7 @@ static int chk_size(register N_INFO *info)
#endif
if (skr != size)
{
info->s->state.data_file_length=(ulong) size; /* Skipp other errors */
info->s->state.data_file_length=(ulong) size; /* Skip other errors */
if (skr > size && skr != size + MEMMAP_EXTRA_MARGIN)
{
error=1;
@ -2672,7 +2672,7 @@ static int sort_get_next_record()
goto try_next;
block_info.second_read=0;
searching=1;
for (i=1 ; i < 11 ; i++) /* Skipp from read string */
for (i=1 ; i < 11 ; i++) /* Skip from read string */
if (block_info.header[i] >= 1 && block_info.header[i] <= 16)
break;
pos+=(ulong) i;

View file

@ -144,7 +144,7 @@ static void get_options(register int *argc, register char ***argv)
switch((option=*pos)) {
case '#':
DBUG_PUSH (++pos);
pos=" "; /* Skipp rest of arg */
pos=" "; /* Skip rest of arg */
break;
case 'c':
if (! *++pos)

View file

@ -28,7 +28,7 @@
#include <io.h>
#endif
#ifndef __GNU_LIBRARY__
#define __GNU_LIBRARY__ /* Skipp warnings in getopt.h */
#define __GNU_LIBRARY__ /* Skip warnings in getopt.h */
#endif
#include <my_getopt.h>

View file

@ -136,7 +136,7 @@ int main(int argc, char *argv[])
err:
printf("got error: %3d when using nisam-database\n",my_errno);
exit(1);
return 0; /* skipp warning */
return 0; /* skip warning */
} /* main */

View file

@ -186,7 +186,7 @@ void STDCALL mysql_server_end()
static MYSQL_PARAMETERS mysql_internal_parameters=
{&max_allowed_packet, &net_buffer_length};
MYSQL_PARAMETERS *STDCALL mysql_get_parameters()
MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void)
{
return &mysql_internal_parameters;
}
@ -616,60 +616,10 @@ mysql_connect(MYSQL *mysql,const char *host,
#endif
#ifdef CHECK_LICENSE
/*
Check server side variable 'license'.
If the variable does not exist or does not contain 'Commercial',
we're talking to non-commercial server from commercial client.
SYNOPSIS
check_license()
RETURN VALUE
0 success
!0 network error or the server is not commercial.
Error code is saved in mysql->net.last_errno.
*/
static int check_license(MYSQL *mysql)
{
MYSQL_ROW row;
MYSQL_RES *res;
NET *net= &mysql->net;
static const char query[]= "SELECT @@license";
static const char required_license[]= STRINGIFY_ARG(LICENSE);
if (mysql_real_query(mysql, query, sizeof(query)-1))
{
if (net->last_errno == ER_UNKNOWN_SYSTEM_VARIABLE)
{
net->last_errno= CR_WRONG_LICENSE;
sprintf(net->last_error, ER(net->last_errno), required_license);
}
return 1;
}
if (!(res= mysql_use_result(mysql)))
return 1;
row= mysql_fetch_row(res);
/*
If no rows in result set, or column value is NULL (none of these
two is ever true for server variables now), or column value
mismatch, set wrong license error.
*/
if (!net->last_errno &&
(!row || !row[0] ||
strncmp(row[0], required_license, sizeof(required_license))))
{
net->last_errno= CR_WRONG_LICENSE;
sprintf(net->last_error, ER(net->last_errno), required_license);
}
mysql_free_result(res);
return net->last_errno;
}
#endif /* CHECK_LICENSE */
/**************************************************************************
Change user and database
**************************************************************************/
int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd)
{
NET *net= &mysql->net;
@ -1690,70 +1640,67 @@ myodbc_remove_escape(MYSQL *mysql,char *name)
}
/********************************************************************
Implementation of new client API for 4.1 version.
Implementation of new client-server prototypes for 4.1 version
starts from here ..
mysql_* are real prototypes used by applications
mysql_stmt_* are real prototypes used by applications.
To make API work in embedded library all functions performing
real I/O are prefixed with 'cli_' (abbreviated from 'Call Level
Interface'). This functions are invoked via pointers set in
MYSQL::methods structure. Embedded counterparts, prefixed with
'emb_' reside in libmysqld/lib_sql.cc.
*********************************************************************/
/********************************************************************
Misc Utility functions
********************************************************************/
/*
Set the internal stmt error messages
*/
static void set_stmt_error(MYSQL_STMT * stmt, int errcode,
const char *sqlstate)
{
DBUG_ENTER("set_stmt_error");
DBUG_PRINT("enter", ("error: %d '%s'", errcode, ER(errcode)));
DBUG_ASSERT(stmt != 0);
stmt->last_errno= errcode;
strmov(stmt->last_error, ER(errcode));
strmov(stmt->sqlstate, sqlstate);
DBUG_VOID_RETURN;
}
/******************* Declarations ***********************************/
/*
Copy error message to statement handler
These functions are called by function pointer MYSQL_STMT::read_row_func.
Each function corresponds to one of the read methods:
- mysql_stmt_fetch without prior mysql_stmt_store_result,
- mysql_stmt_fetch when result is stored,
- mysql_stmt_fetch when there are no rows (always returns MYSQL_NO_DATA)
*/
void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
const char *sqlstate)
{
DBUG_ENTER("set_stmt_error_msg");
DBUG_PRINT("enter", ("error: %d/%s '%s'", errcode, sqlstate, err));
DBUG_ASSERT(stmt != 0);
stmt->last_errno= errcode;
if (err && err[0])
strmov(stmt->last_error, err);
strmov(stmt->sqlstate, sqlstate);
DBUG_VOID_RETURN;
}
static int stmt_read_row_unbuffered(MYSQL_STMT *stmt, unsigned char **row);
static int stmt_read_row_buffered(MYSQL_STMT *stmt, unsigned char **row);
static int stmt_read_row_no_data(MYSQL_STMT *stmt, unsigned char **row);
/*
Maximum sizes of MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME
values stored in network buffer.
*/
/* 1 (length) + 2 (year) + 1 (month) + 1 (day) */
static const unsigned MAX_DATE_REP_LENGTH= 5;
/*
1 (length) + 1 (is negative) + 4 (day count) + 1 (hour)
+ 1 (minute) + 1 (seconds) + 4 (microseconds)
*/
static const unsigned MAX_TIME_REP_LENGTH= 13;
/*
1 (length) + 2 (year) + 1 (month) + 1 (day) +
1 (hour) + 1 (minute) + 1 (second) + 4 (microseconds)
*/
static const unsigned MAX_DATETIME_REP_LENGTH= 12;
/**************** Misc utility functions ****************************/
/*
Reallocate the NET package to be at least of 'length' bytes
SYNPOSIS
my_realloc_str()
net The NET structure to modify
int length Ensure that net->buff is at least this big
net The NET structure to modify
length Ensure that net->buff is at least this big
RETURN VALUES
0 ok
1 Error
*/
static my_bool my_realloc_str(NET *net, ulong length)
@ -1769,20 +1716,54 @@ static my_bool my_realloc_str(NET *net, ulong length)
DBUG_RETURN(res);
}
/********************************************************************
Prepare related implementations
********************************************************************/
static int stmt_read_row_unbuffered(MYSQL_STMT *stmt, unsigned char **row);
static int stmt_read_row_buffered(MYSQL_STMT *stmt, unsigned char **row);
static int stmt_read_row_no_data(MYSQL_STMT *stmt, unsigned char **row);
/*
Read the prepared statement results ..
Set statement error code, sqlstate, and error message
from given errcode and sqlstate.
*/
NOTE
This is only called for connection to servers that supports
prepared statements (and thus the 4.1 protocol)
static void set_stmt_error(MYSQL_STMT * stmt, int errcode,
const char *sqlstate)
{
DBUG_ENTER("set_stmt_error");
DBUG_PRINT("enter", ("error: %d '%s'", errcode, ER(errcode)));
DBUG_ASSERT(stmt != 0);
stmt->last_errno= errcode;
strmov(stmt->last_error, ER(errcode));
strmov(stmt->sqlstate, sqlstate);
DBUG_VOID_RETURN;
}
/*
Set statement error code, sqlstate, and error message.
*/
void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
const char *sqlstate)
{
DBUG_ENTER("set_stmt_errmsg");
DBUG_PRINT("enter", ("error: %d/%s '%s'", errcode, sqlstate, err));
DBUG_ASSERT(stmt != 0);
stmt->last_errno= errcode;
if (err && err[0])
strmov(stmt->last_error, err);
strmov(stmt->sqlstate, sqlstate);
DBUG_VOID_RETURN;
}
/*
Read and unpack server reply to COM_PREPARE command (sent from
mysql_stmt_prepare).
SYNOPSIS
cli_read_prepare_result()
mysql connection handle
stmt statement handle
RETURN VALUES
0 ok
@ -1802,7 +1783,9 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
pos= (uchar*) mysql->net.read_pos;
stmt->stmt_id= uint4korr(pos+1); pos+= 5;
/* Number of columns in result set */
field_count= uint2korr(pos); pos+= 2;
/* Number of placeholders in the statement */
param_count= uint2korr(pos); pos+= 2;
if (param_count != 0)
@ -1852,10 +1835,30 @@ MYSQL_STMT * STDCALL mysql_prepare(MYSQL *mysql, const char *query,
#endif
/*
Allocate memory and init prepared statement structure
Allocate memory and init prepared statement structure.
SYNOPSIS
mysql_stmt_init()
mysql connection handle
mysql connection handle
DESCRIPTION
This is an entry point of the new API. Returned handle stands for
a server-side prepared statement. Memory for this structure (~700
bytes) is allocated using 'malloc'. Once created, the handle can be
reused many times. Created statement handle is bound to connection
handle provided to this call: it's lifetime is limited by lifetime
of connection.
'mysql_stmt_init()' is a pure local call, server side structure is
created only in mysql_stmt_prepare.
Next steps you may want to make:
- set a statement attribute (mysql_stmt_attr_set()),
- prepare statement handle with a query (mysql_stmt_prepare()),
- close statement handle and free it's memory (mysql_stmt_close()),
- reset statement with mysql_stmt_reset() (a no-op which will
just return).
Behaviour of the rest of API calls on this statement is not defined yet
(though we're working on making each wrong call sequence return
error).
RETURN VALUE
statement structure upon success and NULL if out of
@ -1888,27 +1891,41 @@ mysql_stmt_init(MYSQL *mysql)
DBUG_RETURN(stmt);
}
/*
Prepare server side statement with query:
Prepare server side statement with query.
SYNOPSIS
mysql_stmt_prepare()
query statement to prepare
length statement length
stmt statement handle
query statement to prepare
length statement length
DESCRIPTION
- if this is a re-prepare of the statement, first close previous data
Associate statement with statement handle. This is done both on
client and server sides. At this point the server parses given query
and creates an internal structure to represent it.
Next steps you may want to make:
- find out if this statement returns a result set by
calling mysql_stmt_field_count(), and get result set metadata
with mysql_stmt_result_metadata(),
- if query contains placeholders, bind input parameters to placeholders
using mysql_stmt_bind_param(),
- otherwise proceed directly to mysql_stmt_execute().
IMPLEMENTATION NOTES
- if this is a re-prepare of the statement, first close previous data
structure on the server and free old statement data
- send the query to server and get back number of placeholders,
- then send the query to server and get back number of placeholders,
number of columns in result set (if any), and result set metadata.
At the same time allocate memory for input and output parameters
At the same time allocate memory for input and output parameters
to have less checks in mysql_stmt_bind_{param, result}.
RETURN VALUES
0 success
!0 error
!0 error
*/
int STDCALL
mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length)
{
@ -1988,8 +2005,10 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length)
}
/*
Get the execute query meta information for non-select
statements.
Get result set metadata from reply to mysql_stmt_execute.
This is used mainly for SHOW commands, as metadata for these
commands is sent only with result set.
To be removed when all commands will fully support prepared mode.
*/
static unsigned int alloc_stmt_fields(MYSQL_STMT *stmt)
@ -2032,9 +2051,56 @@ static unsigned int alloc_stmt_fields(MYSQL_STMT *stmt)
return stmt->field_count;
}
/*
Returns prepared meta information in the form of resultset
to client.
Update result set columns metadata if it was sent again in
reply to COM_EXECUTE.
*/
static void update_stmt_fields(MYSQL_STMT *stmt)
{
MYSQL_FIELD *field= stmt->mysql->fields;
MYSQL_FIELD *field_end= field + stmt->field_count;
MYSQL_FIELD *stmt_field= stmt->fields;
DBUG_ASSERT(stmt->field_count == stmt->mysql->field_count);
for (; field < field_end; ++field, ++stmt_field)
{
stmt_field->charsetnr= field->charsetnr;
stmt_field->length = field->length;
stmt_field->type = field->type;
stmt_field->flags = field->flags;
stmt_field->decimals = field->decimals;
}
}
/*
Returns prepared statement metadata in the form of a result set.
SYNOPSIS
mysql_stmt_result_metadata()
stmt statement handle
RETURN
NULL statement contains no result set or out of memory.
In the latter case you can retreive error message
with mysql_stmt_error.
MYSQL_RES a result set with no rows
DESCRIPTION
This function should be used after mysql_stmt_execute().
You can safely check that prepared statement has a result set by calling
mysql_stmt_num_fields(): if number of fields is not zero, you can call
this function to get fields metadata.
Next steps you may want to make:
- find out number of columns in result set by calling
mysql_num_fields(res) (the same value is returned by
mysql_stmt_num_fields)
- fetch metadata for any column with mysql_fetch_field,
mysql_fetch_field_direct, mysql_fetch_fields, mysql_field_seek.
- free returned MYSQL_RES structure with mysql_free_result.
- proceed to binding of output parameters.
*/
MYSQL_RES * STDCALL
@ -2066,8 +2132,9 @@ mysql_stmt_result_metadata(MYSQL_STMT *stmt)
}
/*
Returns parameter columns meta information in the form of
resultset.
Returns parameter columns meta information in the form of
result set.
XXX: not implemented yet.
*/
MYSQL_RES * STDCALL
@ -2086,12 +2153,8 @@ mysql_stmt_param_metadata(MYSQL_STMT *stmt)
}
/********************************************************************
Prepare-execute, and param handling
*********************************************************************/
/****************************************************************************
Functions to store parameter data from a prepared statement.
/*
Functions to store parameter data in network packet.
All functions have the following characteristics:
@ -2103,7 +2166,7 @@ mysql_stmt_param_metadata(MYSQL_STMT *stmt)
RETURN VALUES
0 ok
1 Error (Can't alloc net->buffer)
****************************************************************************/
*/
static void store_param_tinyint(NET *net, MYSQL_BIND *param)
{
@ -2148,7 +2211,7 @@ static void store_param_double(NET *net, MYSQL_BIND *param)
static void store_param_time(NET *net, MYSQL_BIND *param)
{
MYSQL_TIME *tm= (MYSQL_TIME *) param->buffer;
char buff[15], *pos;
char buff[MAX_TIME_REP_LENGTH], *pos;
uint length;
pos= buff+1;
@ -2159,19 +2222,19 @@ static void store_param_time(NET *net, MYSQL_BIND *param)
pos[7]= (uchar) tm->second;
int4store(pos+8, tm->second_part);
if (tm->second_part)
length= 11;
length= 12;
else if (tm->hour || tm->minute || tm->second || tm->day)
length= 8;
else
length= 0;
buff[0]= (char) length++;
buff[0]= (char) length++;
memcpy((char *)net->write_pos, buff, length);
net->write_pos+= length;
}
static void net_store_datetime(NET *net, MYSQL_TIME *tm)
{
char buff[12], *pos;
char buff[MAX_DATETIME_REP_LENGTH], *pos;
uint length;
pos= buff+1;
@ -2212,7 +2275,8 @@ static void store_param_datetime(NET *net, MYSQL_BIND *param)
static void store_param_str(NET *net, MYSQL_BIND *param)
{
ulong length= param->length ? *param->length : param->buffer_length;
/* param->length is always set in mysql_stmt_bind_param */
ulong length= *param->length;
char *to= (char *) net_store_length((char *) net->write_pos, length);
memcpy(to, param->buffer, length);
net->write_pos= (uchar*) to+length;
@ -2261,7 +2325,7 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param)
Param->length should ALWAYS point to the correct length for the type
Either to the length pointer given by the user or param->buffer_length
*/
if ((my_realloc_str(net, 9 + *param->length)))
if ((my_realloc_str(net, *param->length)))
{
set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate);
DBUG_RETURN(1);
@ -2538,16 +2602,37 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt)
*/
if (mysql->methods->stmt_execute(stmt))
DBUG_RETURN(1);
if (!stmt->field_count && mysql->field_count)
if (mysql->field_count)
{
/*
This is 'SHOW'/'EXPLAIN'-like query. Current implementation of
prepared statements can't send result set metadata for this queries
on prepare stage. Read it now.
*/
alloc_stmt_fields(stmt);
/* Server has sent result set metadata */
if (stmt->field_count == 0)
{
/*
This is 'SHOW'/'EXPLAIN'-like query. Current implementation of
prepared statements can't send result set metadata for these queries
on prepare stage. Read it now.
*/
alloc_stmt_fields(stmt);
}
else
{
/*
Update result set metadata if it for some reason changed between
prepare and execute, i.e.:
- in case of 'SELECT ?' we don't know column type unless data was
supplied to mysql_stmt_execute, so updated column type is sent
now.
- if data dictionary changed between prepare and execute, for
example a table used in the query was altered.
Note, that now (4.1.3) we always send metadata in reply to
COM_EXECUTE (even if it is not necessary), so either this or
previous always branch works.
TODO: send metadata only when it's really necessary and add a warning
'Metadata changed' when it's sent twice.
*/
update_stmt_fields(stmt);
}
}
stmt->state= MYSQL_STMT_EXECUTE_DONE;
if (stmt->field_count)
{
@ -2579,6 +2664,16 @@ my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt)
}
/*
Returns the number of result columns for the most recent query
run on this statement.
*/
unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt)
{
return stmt->field_count;
}
/*
Return last inserted id for auto_increment columns
*/
@ -2588,6 +2683,7 @@ my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt)
return stmt->insert_id;
}
static my_bool int_is_null_true= 1; /* Used for MYSQL_TYPE_NULL */
static my_bool int_is_null_false= 0;
@ -2663,15 +2759,17 @@ my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
param->store_param_func= store_param_double;
break;
case MYSQL_TYPE_TIME:
/* Buffer length ignored for DATE, TIME and DATETIME */
param->store_param_func= store_param_time;
param->buffer_length= MAX_TIME_REP_LENGTH;
break;
case MYSQL_TYPE_DATE:
param->store_param_func= store_param_date;
param->buffer_length= MAX_DATE_REP_LENGTH;
break;
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
param->store_param_func= store_param_datetime;
param->buffer_length= MAX_DATETIME_REP_LENGTH;
break;
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
@ -2680,6 +2778,11 @@ my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_STRING:
param->store_param_func= store_param_str;
/*
For variable length types we expect user to set
length or buffer_length. Otherwise mysql_stmt_execute
will just fail.
*/
break;
default:
strmov(stmt->sqlstate, unknown_sqlstate);
@ -2721,7 +2824,6 @@ my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
1 error
*/
my_bool STDCALL
mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
const char *data, ulong length)
@ -2819,22 +2921,23 @@ static uint read_binary_time(MYSQL_TIME *tm, uchar **pos)
uchar *to;
uint length;
/* net_field_length will set pos to the first byte of data */
if (!(length= net_field_length(pos)))
{
set_zero_time(tm);
return 0;
}
to= *pos;
tm->second_part= (length > 8 ) ? (ulong) sint4korr(to+7): 0;
to= *pos;
tm->neg= (bool) to[0];
tm->day= (ulong) sint4korr(to+1);
tm->hour= (uint) to[5];
tm->minute= (uint) to[6];
tm->second= (uint) to[7];
tm->second_part= (length > 8) ? (ulong) sint4korr(to+8) : 0;
tm->year= tm->month= 0;
tm->neg= (bool)to[0];
return length;
}
@ -2843,16 +2946,20 @@ static uint read_binary_datetime(MYSQL_TIME *tm, uchar **pos)
{
uchar *to;
uint length;
if (!(length= net_field_length(pos)))
{
set_zero_time(tm);
return 0;
}
to= *pos;
tm->second_part= (length > 7 ) ? (ulong) sint4korr(to+7): 0;
to= *pos;
tm->neg= 0;
tm->year= (uint) sint2korr(to);
tm->month= (uint) to[2];
tm->day= (uint) to[3];
if (length > 4)
{
tm->hour= (uint) to[4];
@ -2861,11 +2968,7 @@ static uint read_binary_datetime(MYSQL_TIME *tm, uchar **pos)
}
else
tm->hour= tm->minute= tm->second= 0;
tm->year= (uint) sint2korr(to);
tm->month= (uint) to[2];
tm->day= (uint) to[3];
tm->neg= 0;
tm->second_part= (length > 7) ? (ulong) sint4korr(to+7) : 0;
return length;
}
@ -3124,7 +3227,7 @@ static void send_data_time(MYSQL_BIND *param, MYSQL_TIME ltime,
}
}
}
/* Fetch data to buffers */

View file

@ -131,3 +131,4 @@ EXPORTS
mysql_stmt_insert_id
mysql_stmt_attr_get
mysql_stmt_attr_set
mysql_stmt_field_count

View file

@ -22,7 +22,6 @@ MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DNO_EMBEDDED_ACCESS_CHECKS \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\""

View file

@ -2,7 +2,8 @@ LIBRARY LIBMYSQLD
DESCRIPTION 'MySQL 4.1 Embedded Server Library'
VERSION 4.1
EXPORTS
_dig_vec
_dig_vec_upper
_dig_vec_lower
bmove_upp
delete_dynamic
free_defaults

View file

@ -62,7 +62,7 @@ int handle_locking)
{
if ((end=buff+length)[-1] == '\n')
end[-1]='\0';
if (buff[0] && buff[0] != '#') /* Skipp empty lines and comments */
if (buff[0] && buff[0] != '#') /* Skip empty lines and comments */
{
last_isam=isam;
if (!test_if_hard_path(buff))

View file

@ -307,7 +307,7 @@ int chk_size(MI_CHECK *param, register MI_INFO *info)
#endif
if (skr != size)
{
info->state->data_file_length=size; /* Skipp other errors */
info->state->data_file_length=size; /* Skip other errors */
if (skr > size && skr != size + MEMMAP_EXTRA_MARGIN)
{
error=1;
@ -3672,7 +3672,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
if (param->language)
keyseg->language=param->language; /* change language */
}
keyseg++; /* Skipp end pointer */
keyseg++; /* Skip end pointer */
}
/* Copy the unique definitions and change them to point at the new key

View file

@ -816,7 +816,7 @@ static uint remove_key(MI_KEYDEF *keyinfo, uint nod_flag,
if (!(*start & 128))
prev_length=0; /* prev key not packed */
if (keyinfo->seg[0].flag & HA_NULL_PART)
lastkey++; /* Skipp null marker */
lastkey++; /* Skip null marker */
get_key_length(lastkey_length,lastkey);
if (!next_length) /* Same key after */
{

View file

@ -221,7 +221,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
k_length-= 2+length;
set_if_smaller(length,tmp_length); /* Safety */
store_key_length_inc(key,length);
old+=2; /* Skipp length */
old+=2; /* Skip length */
memcpy((byte*) key, pos+2,(size_t) length);
key+= length;
continue;

View file

@ -20,6 +20,7 @@
#include "sp_defs.h"
#include "rt_index.h"
#include <m_ctype.h>
#include <assert.h>
#if defined(MSDOS) || defined(__WIN__)
#ifdef __WIN__

View file

@ -761,7 +761,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
}
if (keyseg->flag & HA_NULL_PART)
{
key++; /* Skipp null marker*/
key++; /* Skip null marker*/
start++;
}
@ -1395,7 +1395,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
if (prev_key && !*prev_key++)
org_key=prev_key=0; /* Can't pack against prev */
else if (org_key)
org_key++; /* Skipp NULL */
org_key++; /* Skip NULL */
}
else
s_temp->store_not_null=0;

View file

@ -71,6 +71,7 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
const byte *pos, *end;
ha_checksum crc=0;
HA_KEYSEG *keyseg;
ulong seed= 4;
for (keyseg=def->seg ; keyseg < def->end ; keyseg++)
{
@ -108,9 +109,8 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
end= pos+length;
if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT)
{
ulong nr=1, nr2=4;
keyseg->charset->coll->hash_sort(keyseg->charset,(const uchar*)pos,length,&nr, &nr2);
crc=nr;
keyseg->charset->coll->hash_sort(keyseg->charset,
(const uchar*) pos, length, &crc, &seed);
}
else
while (pos != end)

View file

@ -145,7 +145,7 @@ static void get_options(register int *argc, register char ***argv)
switch((option=*pos)) {
case '#':
DBUG_PUSH (++pos);
pos=" "; /* Skipp rest of arg */
pos=" "; /* Skip rest of arg */
break;
case 'c':
if (! *++pos)

View file

@ -24,6 +24,8 @@
#include "rt_mbr.h"
#define REINSERT_BUFFER_INC 10
#define PICK_BY_AREA
/*#define PICK_BY_PERIMETER*/
typedef struct st_page_level
{
@ -438,6 +440,84 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
}
/*
Choose non-leaf better key for insertion
*/
#ifdef PICK_BY_PERIMETER
static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, uchar *page_buf, uint nod_flag)
{
double increase;
double best_incr = DBL_MAX;
double perimeter;
double best_perimeter;
uchar *best_key;
uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
uchar *last = rt_PAGE_END(page_buf);
LINT_INIT(best_perimeter);
LINT_INIT(best_key);
for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
{
if ((increase = rtree_perimeter_increase(keyinfo->seg, k, key, key_length,
&perimeter)) == -1)
return NULL;
if ((increase < best_incr)||
(increase == best_incr && perimeter < best_perimeter))
{
best_key = k;
best_perimeter= perimeter;
best_incr = increase;
}
}
return best_key;
}
#endif /*PICK_BY_PERIMETER*/
#ifdef PICK_BY_AREA
static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, uchar *page_buf, uint nod_flag)
{
double increase;
double best_incr = DBL_MAX;
double area;
double best_area;
uchar *best_key;
uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
uchar *last = rt_PAGE_END(page_buf);
LINT_INIT(best_area);
LINT_INIT(best_key);
for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
{
if ((increase = rtree_area_increase(keyinfo->seg, k, key, key_length,
&area)) == -1)
return NULL;
if (increase < best_incr)
{
best_key = k;
best_area = area;
best_incr = increase;
}
else
{
if ((increase == best_incr) && (area < best_area))
{
best_key = k;
best_area = area;
best_incr = increase;
}
}
}
return best_key;
}
#endif /*PICK_BY_AREA*/
/*
Go down and insert key into tree
@ -469,7 +549,7 @@ static int rtree_insert_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
if ((ins_level == -1 && nod_flag) || /* key: go down to leaf */
(ins_level > -1 && ins_level > level)) /* branch: go down to ins_level */
{
if ((k = rtree_choose_key(info, keyinfo, key, key_length, page_buf,
if ((k = rtree_pick_key(info, keyinfo, key, key_length, page_buf,
nod_flag)) == NULL)
goto err1;
switch ((res = rtree_insert_req(info, keyinfo, key, key_length,
@ -579,7 +659,7 @@ static int rtree_insert_level(MI_INFO *info, uint keynr, uchar *key,
mi_putint(new_root_buf, 2, nod_flag);
if ((new_root = _mi_new(info, keyinfo, DFLT_INIT_HITS)) ==
HA_OFFSET_ERROR)
HA_OFFSET_ERROR)
goto err1;
new_key = new_root_buf + keyinfo->block_length + nod_flag;

View file

@ -25,7 +25,7 @@
(nod_flag ? nod_flag : info->s->base.rec_reflength))
#define rt_PAGE_END(page) (page + mi_getint(page))
#define rt_PAGE_MIN_SIZE(block_length) ((uint)(block_length) / 2)
#define rt_PAGE_MIN_SIZE(block_length) ((uint)(block_length) / 3)
int rtree_insert(MI_INFO *info, uint keynr, uchar *key, uint key_length);
int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length);

View file

@ -36,7 +36,8 @@ int rtree_add_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint page_size = mi_getint(page_buf);
uint nod_flag = mi_test_if_nod(page_buf);
if (page_size + key_length + nod_flag <= keyinfo->block_length)
if (page_size + key_length + info->s->base.rec_reflength <=
keyinfo->block_length)
{
/* split won't be necessary */
if (nod_flag)
@ -96,47 +97,4 @@ int rtree_set_key_mbr(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
return rtree_page_mbr(info, keyinfo->seg, info->buff, key, key_length);
}
/*
Choose non-leaf better key for insertion
*/
uchar *rtree_choose_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, uchar *page_buf, uint nod_flag)
{
double increase;
double best_incr = DBL_MAX;
double area;
double best_area;
uchar *best_key;
uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
uchar *last = rt_PAGE_END(page_buf);
LINT_INIT(best_area);
LINT_INIT(best_key);
for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
{
if ((increase = rtree_area_increase(keyinfo->seg, key, k, key_length,
&area)) == -1)
return NULL;
if (increase < best_incr)
{
best_key = k;
best_area = area;
best_incr = increase;
}
else
{
if ((increase == best_incr) && (area < best_area))
{
best_key = k;
best_area = area;
best_incr = increase;
}
}
}
return best_key;
}
#endif /*HAVE_RTREE_KEYS*/

View file

@ -28,7 +28,6 @@ int rtree_delete_key(MI_INFO *info, uchar *page, uchar *key,
uint key_length, uint nod_flag);
int rtree_set_key_mbr(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, my_off_t child_page);
uchar *rtree_choose_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, uchar *page_buf, uint nod_flag);
#endif /*HAVE_RTREE_KEYS*/
#endif /* _rt_key_h */

View file

@ -26,7 +26,7 @@
#define CONTAIN_CMP(amin, amax, bmin, bmax) ((bmin > amin) || (bmax < amax))
#define WITHIN_CMP(amin, amax, bmin, bmax) ((amin > bmin) || (amax < bmax))
#define DISJOINT_CMP(amin, amax, bmin, bmax) ((amin <= bmax) && (bmin <= amax))
#define EQUAL_CMP(amix, amax, bmin, bmax) ((amix != bmin) || (amax != bmax))
#define EQUAL_CMP(amin, amax, bmin, bmax) ((amin != bmin) || (amax != bmax))
#define FCMP(A, B) ((int)(A) - (int)(B))
#define p_inc(A, B, X) {A += X; B += X;}
@ -63,12 +63,9 @@
type amin, amax, bmin, bmax; \
amin = korr_func(a); \
bmin = korr_func(b); \
p_inc(a, b, len); \
amax = korr_func(a); \
bmax = korr_func(b); \
amax = korr_func(a+len); \
bmax = korr_func(b+len); \
RT_CMP(nextflag); \
p_inc(a, b, len); \
break; \
}
#define RT_CMP_GET(type, get_func, len, nextflag) \
@ -76,12 +73,9 @@
type amin, amax, bmin, bmax; \
get_func(amin, a); \
get_func(bmin, b); \
p_inc(a, b, len); \
get_func(amax, a); \
get_func(bmax, b); \
get_func(amax, a+len); \
get_func(bmax, b+len); \
RT_CMP(nextflag); \
p_inc(a, b, len); \
break; \
}
/*
@ -100,54 +94,55 @@ int rtree_key_cmp(HA_KEYSEG *keyseg, uchar *b, uchar *a, uint key_length,
{
for (; (int) key_length > 0; keyseg += 2 )
{
key_length -= keyseg->length * 2;
uint32 keyseg_length;
switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_TEXT:
case HA_KEYTYPE_BINARY:
case HA_KEYTYPE_VARTEXT:
case HA_KEYTYPE_VARBINARY:
case HA_KEYTYPE_NUM:
default:
return 1;
break;
case HA_KEYTYPE_INT8:
{
int amin,amax,bmin,bmax;
amin = (int)*((signed char *)a);
bmin = (int)*((signed char *)b);
p_inc(a, b, 1);
amax = (int)*((signed char *)a);
bmax = (int)*((signed char *)b);
RT_CMP(nextflag);
p_inc(a, b, 1);
break;
}
RT_CMP_KORR(int8, mi_sint1korr, 1, nextflag);
break;
case HA_KEYTYPE_BINARY:
RT_CMP_KORR(uint8, mi_uint1korr, 1, nextflag);
break;
case HA_KEYTYPE_SHORT_INT:
RT_CMP_KORR(int16, mi_sint2korr, 2, nextflag);
break;
case HA_KEYTYPE_USHORT_INT:
RT_CMP_KORR(uint16, mi_uint2korr, 2, nextflag);
break;
case HA_KEYTYPE_INT24:
RT_CMP_KORR(int32, mi_sint3korr, 3, nextflag);
break;
case HA_KEYTYPE_UINT24:
RT_CMP_KORR(uint32, mi_uint3korr, 3, nextflag);
break;
case HA_KEYTYPE_LONG_INT:
RT_CMP_KORR(int32, mi_sint4korr, 4, nextflag);
break;
case HA_KEYTYPE_ULONG_INT:
RT_CMP_KORR(uint32, mi_uint4korr, 4, nextflag);
break;
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG:
RT_CMP_KORR(longlong, mi_sint8korr, 8, nextflag)
break;
case HA_KEYTYPE_ULONGLONG:
RT_CMP_KORR(ulonglong, mi_uint8korr, 8, nextflag)
break;
#endif
case HA_KEYTYPE_FLOAT:
RT_CMP_GET(float, mi_float4get, 4, nextflag);
break;
case HA_KEYTYPE_DOUBLE:
RT_CMP_GET(double, mi_float8get, 8, nextflag);
break;
case HA_KEYTYPE_END:
goto end;
default:
return 1;
}
keyseg_length= keyseg->length * 2;
key_length-= keyseg_length;
a+= keyseg_length;
b+= keyseg_length;
}
end:
@ -167,22 +162,16 @@ end:
{ \
type amin, amax; \
amin = korr_func(a); \
a += len; \
amax = korr_func(a); \
a += len; \
amax = korr_func(a+len); \
res *= (cast(amax) - cast(amin)); \
break; \
}
#define RT_VOL_GET(type, get_func, len, cast) \
{ \
type amin, amax; \
get_func(amin, a); \
a += len; \
get_func(amax, a); \
a += len; \
get_func(amax, a+len); \
res *= (cast(amax) - cast(amin)); \
break; \
}
/*
@ -193,53 +182,55 @@ double rtree_rect_volume(HA_KEYSEG *keyseg, uchar *a, uint key_length)
double res = 1;
for (; (int)key_length > 0; keyseg += 2)
{
key_length -= keyseg->length * 2;
uint32 keyseg_length;
switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_TEXT:
case HA_KEYTYPE_BINARY:
case HA_KEYTYPE_VARTEXT:
case HA_KEYTYPE_VARBINARY:
case HA_KEYTYPE_NUM:
default:
return 1;
break;
case HA_KEYTYPE_INT8:
{
int amin, amax;
amin = (int)*((signed char *)a);
a += 1;
amax = (int)*((signed char *)a);
a += 1;
res *= ((double)amax - (double)amin);
break;
}
RT_VOL_KORR(int8, mi_sint1korr, 1, (double));
break;
case HA_KEYTYPE_BINARY:
RT_VOL_KORR(uint8, mi_uint1korr, 1, (double));
break;
case HA_KEYTYPE_SHORT_INT:
RT_VOL_KORR(int16, mi_sint2korr, 2, (double));
break;
case HA_KEYTYPE_USHORT_INT:
RT_VOL_KORR(uint16, mi_uint2korr, 2, (double));
break;
case HA_KEYTYPE_INT24:
RT_VOL_KORR(int32, mi_sint3korr, 3, (double));
break;
case HA_KEYTYPE_UINT24:
RT_VOL_KORR(uint32, mi_uint3korr, 3, (double));
break;
case HA_KEYTYPE_LONG_INT:
RT_VOL_KORR(int32, mi_sint4korr, 4, (double));
break;
case HA_KEYTYPE_ULONG_INT:
RT_VOL_KORR(uint32, mi_uint4korr, 4, (double));
break;
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG:
RT_VOL_KORR(longlong, mi_sint8korr, 8, (double));
break;
case HA_KEYTYPE_ULONGLONG:
RT_VOL_KORR(longlong, mi_sint8korr, 8, ulonglong2double);
break;
#endif
case HA_KEYTYPE_FLOAT:
RT_VOL_GET(float, mi_float4get, 4, (double));
break;
case HA_KEYTYPE_DOUBLE:
RT_VOL_GET(double, mi_float8get, 8, (double));
break;
case HA_KEYTYPE_END:
key_length = 0;
break;
default:
return -1;
}
keyseg_length= keyseg->length * 2;
key_length-= keyseg_length;
a+= keyseg_length;
}
return res;
}
@ -248,81 +239,78 @@ double rtree_rect_volume(HA_KEYSEG *keyseg, uchar *a, uint key_length)
{ \
type amin, amax; \
amin = korr_func(a); \
a += len; \
amax = korr_func(a); \
a += len; \
amax = korr_func(a+len); \
*res++ = cast(amin); \
*res++ = cast(amax); \
break; \
}
#define RT_D_MBR_GET(type, get_func, len, cast) \
{ \
type amin, amax; \
get_func(amin, a); \
a += len; \
get_func(amax, a); \
a += len; \
get_func(amax, a+len); \
*res++ = cast(amin); \
*res++ = cast(amax); \
break; \
}
/*
Creates an MBR as an array of doubles.
Creates an MBR as an array of doubles.
*/
int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
{
for (; (int)key_length > 0; keyseg += 2)
{
key_length -= keyseg->length * 2;
uint32 keyseg_length;
switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_TEXT:
case HA_KEYTYPE_BINARY:
case HA_KEYTYPE_VARTEXT:
case HA_KEYTYPE_VARBINARY:
case HA_KEYTYPE_NUM:
default:
return 1;
break;
case HA_KEYTYPE_INT8:
{
int amin, amax;
amin = (int)*((signed char *)a);
a += 1;
amax = (int)*((signed char *)a);
a += 1;
*res++ = (double)amin;
*res++ = (double)amax;
break;
}
RT_D_MBR_KORR(int8, mi_sint1korr, 1, (double));
break;
case HA_KEYTYPE_BINARY:
RT_D_MBR_KORR(uint8, mi_uint1korr, 1, (double));
break;
case HA_KEYTYPE_SHORT_INT:
RT_D_MBR_KORR(int16, mi_sint2korr, 2, (double));
break;
case HA_KEYTYPE_USHORT_INT:
RT_D_MBR_KORR(uint16, mi_uint2korr, 2, (double));
break;
case HA_KEYTYPE_INT24:
RT_D_MBR_KORR(int32, mi_sint3korr, 3, (double));
break;
case HA_KEYTYPE_UINT24:
RT_D_MBR_KORR(uint32, mi_uint3korr, 3, (double));
break;
case HA_KEYTYPE_LONG_INT:
RT_D_MBR_KORR(int32, mi_sint4korr, 4, (double));
break;
case HA_KEYTYPE_ULONG_INT:
RT_D_MBR_KORR(uint32, mi_uint4korr, 4, (double));
break;
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG:
RT_D_MBR_KORR(longlong, mi_sint8korr, 8, (double));
break;
case HA_KEYTYPE_ULONGLONG:
RT_D_MBR_KORR(longlong, mi_sint8korr, 8, ulonglong2double);
break;
#endif
case HA_KEYTYPE_FLOAT:
RT_D_MBR_GET(float, mi_float4get, 4, (double));
break;
case HA_KEYTYPE_DOUBLE:
RT_D_MBR_GET(double, mi_float8get, 8, (double));
break;
case HA_KEYTYPE_END:
key_length = 0;
break;
default:
return 1;
}
keyseg_length= keyseg->length * 2;
key_length-= keyseg_length;
a+= keyseg_length;
}
return 0;
}
@ -332,17 +320,12 @@ int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
type amin, amax, bmin, bmax; \
amin = korr_func(a); \
bmin = korr_func(b); \
p_inc(a, b, len); \
amax = korr_func(a); \
bmax = korr_func(b); \
p_inc(a, b, len); \
amax = korr_func(a+len); \
bmax = korr_func(b+len); \
amin = min(amin, bmin); \
amax = max(amax, bmax); \
store_func(c, amin); \
c += len; \
store_func(c, amax); \
c += len; \
break; \
store_func(c+len, amax); \
}
#define RT_COMB_GET(type, get_func, store_func, len) \
@ -350,17 +333,12 @@ int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
type amin, amax, bmin, bmax; \
get_func(amin, a); \
get_func(bmin, b); \
p_inc(a, b, len); \
get_func(amax, a); \
get_func(bmax, b); \
p_inc(a, b, len); \
get_func(amax, a+len); \
get_func(bmax, b+len); \
amin = min(amin, bmin); \
amax = max(amax, bmax); \
store_func(c, amin); \
c += len; \
store_func(c, amax); \
c += len; \
break; \
store_func(c+len, amax); \
}
/*
@ -372,81 +350,75 @@ int rtree_d_mbr(HA_KEYSEG *keyseg, uchar *a, uint key_length, double *res)
int rtree_combine_rect(HA_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c,
uint key_length)
{
for ( ; (int) key_length > 0 ; keyseg += 2)
{
key_length -= keyseg->length * 2;
uint32 keyseg_length;
switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_TEXT:
case HA_KEYTYPE_BINARY:
case HA_KEYTYPE_VARTEXT:
case HA_KEYTYPE_VARBINARY:
case HA_KEYTYPE_NUM:
default:
return 1;
break;
case HA_KEYTYPE_INT8:
{
int amin, amax, bmin, bmax;
amin = (int)*((signed char *)a);
bmin = (int)*((signed char *)b);
p_inc(a, b, 1);
amax = (int)*((signed char *)a);
bmax = (int)*((signed char *)b);
p_inc(a, b, 1);
amin = min(amin, bmin);
amax = max(amax, bmax);
*((signed char*)c) = amin;
c += 1;
*((signed char*)c) = amax;
c += 1;
break;
}
RT_COMB_KORR(int8, mi_sint1korr, mi_int1store, 1);
break;
case HA_KEYTYPE_BINARY:
RT_COMB_KORR(uint8, mi_uint1korr, mi_int1store, 1);
break;
case HA_KEYTYPE_SHORT_INT:
RT_COMB_KORR(int16, mi_sint2korr, mi_int2store, 2);
break;
case HA_KEYTYPE_USHORT_INT:
RT_COMB_KORR(uint16, mi_uint2korr, mi_int2store, 2);
break;
case HA_KEYTYPE_INT24:
RT_COMB_KORR(int32, mi_sint3korr, mi_int3store, 3);
break;
case HA_KEYTYPE_UINT24:
RT_COMB_KORR(uint32, mi_uint3korr, mi_int3store, 3);
break;
case HA_KEYTYPE_LONG_INT:
RT_COMB_KORR(int32, mi_sint4korr, mi_int4store, 4);
break;
case HA_KEYTYPE_ULONG_INT:
RT_COMB_KORR(uint32, mi_uint4korr, mi_int4store, 4);
break;
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG:
RT_COMB_KORR(longlong, mi_sint8korr, mi_int8store, 8);
break;
case HA_KEYTYPE_ULONGLONG:
RT_COMB_KORR(ulonglong, mi_uint8korr, mi_int8store, 8);
break;
#endif
case HA_KEYTYPE_FLOAT:
RT_COMB_GET(float, mi_float4get, mi_float4store, 4);
break;
case HA_KEYTYPE_DOUBLE:
RT_COMB_GET(double, mi_float8get, mi_float8store, 8);
break;
case HA_KEYTYPE_END:
return 0;
default:
return 1;
}
keyseg_length= keyseg->length * 2;
key_length-= keyseg_length;
a+= keyseg_length;
b+= keyseg_length;
c+= keyseg_length;
}
return 0;
}
#define RT_OVL_AREA_KORR(type, korr_func, len) \
{ \
type amin, amax, bmin, bmax; \
amin = korr_func(a); \
bmin = korr_func(b); \
p_inc(a, b, len); \
amax = korr_func(a); \
bmax = korr_func(b); \
p_inc(a, b, len); \
amax = korr_func(a+len); \
bmax = korr_func(b+len); \
amin = max(amin, bmin); \
amax = min(amax, bmax); \
if (amin >= amax) \
return 0; \
res *= amax - amin; \
break; \
}
#define RT_OVL_AREA_GET(type, get_func, len) \
@ -454,16 +426,13 @@ int rtree_combine_rect(HA_KEYSEG *keyseg, uchar* a, uchar* b, uchar* c,
type amin, amax, bmin, bmax; \
get_func(amin, a); \
get_func(bmin, b); \
p_inc(a, b, len); \
get_func(amax, a); \
get_func(bmax, b); \
p_inc(a, b, len); \
get_func(amax, a+len); \
get_func(bmax, b+len); \
amin = max(amin, bmin); \
amax = min(amax, bmax); \
if (amin >= amax) \
return 0; \
res *= amax - amin; \
break; \
}
/*
@ -475,58 +444,55 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
double res = 1;
for (; (int) key_length > 0 ; keyseg += 2)
{
key_length -= keyseg->length * 2;
uint32 keyseg_length;
switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_TEXT:
case HA_KEYTYPE_BINARY:
case HA_KEYTYPE_VARTEXT:
case HA_KEYTYPE_VARBINARY:
case HA_KEYTYPE_NUM:
default:
return -1;
break;
case HA_KEYTYPE_INT8:
{
int amin, amax, bmin, bmax;
amin = (int)*((signed char *)a);
bmin = (int)*((signed char *)b);
p_inc(a, b, 1);
amax = (int)*((signed char *)a);
bmax = (int)*((signed char *)b);
p_inc(a, b, 1);
amin = max(amin, bmin);
amax = min(amax, bmax);
if (amin >= amax)
return 0;
res *= amax - amin;
break;
}
RT_OVL_AREA_KORR(int8, mi_sint1korr, 1);
break;
case HA_KEYTYPE_BINARY:
RT_OVL_AREA_KORR(uint8, mi_uint1korr, 1);
break;
case HA_KEYTYPE_SHORT_INT:
RT_OVL_AREA_KORR(int16, mi_sint2korr, 2);
break;
case HA_KEYTYPE_USHORT_INT:
RT_OVL_AREA_KORR(uint16, mi_uint2korr, 2);
break;
case HA_KEYTYPE_INT24:
RT_OVL_AREA_KORR(int32, mi_sint3korr, 3);
break;
case HA_KEYTYPE_UINT24:
RT_OVL_AREA_KORR(uint32, mi_uint3korr, 3);
break;
case HA_KEYTYPE_LONG_INT:
RT_OVL_AREA_KORR(int32, mi_sint4korr, 4);
break;
case HA_KEYTYPE_ULONG_INT:
RT_OVL_AREA_KORR(uint32, mi_uint4korr, 4);
break;
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG:
RT_OVL_AREA_KORR(longlong, mi_sint8korr, 8);
break;
case HA_KEYTYPE_ULONGLONG:
RT_OVL_AREA_KORR(longlong, mi_sint8korr, 8);
break;
#endif
case HA_KEYTYPE_FLOAT:
RT_OVL_AREA_GET(float, mi_float4get, 4);
break;
case HA_KEYTYPE_DOUBLE:
RT_OVL_AREA_GET(double, mi_float8get, 8);
break;
case HA_KEYTYPE_END:
return res;
default:
return -1;
}
keyseg_length= keyseg->length * 2;
key_length-= keyseg_length;
a+= keyseg_length;
b+= keyseg_length;
}
return res;
}
@ -536,13 +502,10 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
type amin, amax, bmin, bmax; \
amin = korr_func(a); \
bmin = korr_func(b); \
p_inc(a, b, len); \
amax = korr_func(a); \
bmax = korr_func(b); \
p_inc(a, b, len); \
amax = korr_func(a+len); \
bmax = korr_func(b+len); \
a_area *= (((double)amax) - ((double)amin)); \
*ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin)); \
break; \
}
#define RT_AREA_INC_GET(type, get_func, len)\
@ -550,13 +513,10 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
type amin, amax, bmin, bmax; \
get_func(amin, a); \
get_func(bmin, b); \
p_inc(a, b, len); \
get_func(amax, a); \
get_func(bmax, b); \
p_inc(a, b, len); \
get_func(amax, a+len); \
get_func(bmax, b+len); \
a_area *= (((double)amax) - ((double)amin)); \
*ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin)); \
break; \
}
/*
@ -565,70 +525,159 @@ Calculates MBR_AREA(a+b) - MBR_AREA(a)
double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
uint key_length, double *ab_area)
{
double a_area = 1;
double a_area= 1.0;
*ab_area = 1;
*ab_area= 1.0;
for (; (int)key_length > 0; keyseg += 2)
{
key_length -= keyseg->length * 2;
/* Handle NULL part */
if (keyseg->null_bit)
{
uint32 keyseg_length;
if (keyseg->null_bit) /* Handle NULL part */
return -1;
}
switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_TEXT:
case HA_KEYTYPE_BINARY:
case HA_KEYTYPE_VARTEXT:
case HA_KEYTYPE_VARBINARY:
case HA_KEYTYPE_NUM:
default:
return 1;
break;
case HA_KEYTYPE_INT8:
{
int amin, amax, bmin, bmax;
amin = (int)*((signed char *)a);
bmin = (int)*((signed char *)b);
p_inc(a, b, 1);
amax = (int)*((signed char *)a);
bmax = (int)*((signed char *)b);
p_inc(a, b, 1);
a_area *= (((double)amax) - ((double)amin));
*ab_area *= ((double)max(amax, bmax) - (double)min(amin, bmin));
break;
}
RT_AREA_INC_KORR(int8, mi_sint1korr, 1);
break;
case HA_KEYTYPE_BINARY:
RT_AREA_INC_KORR(uint8, mi_uint1korr, 1);
break;
case HA_KEYTYPE_SHORT_INT:
RT_AREA_INC_KORR(int16, mi_sint2korr, 2);
break;
case HA_KEYTYPE_USHORT_INT:
RT_AREA_INC_KORR(uint16, mi_uint2korr, 2);
break;
case HA_KEYTYPE_INT24:
RT_AREA_INC_KORR(int32, mi_sint3korr, 3);
break;
case HA_KEYTYPE_UINT24:
RT_AREA_INC_KORR(int32, mi_uint3korr, 3);
break;
case HA_KEYTYPE_LONG_INT:
RT_AREA_INC_KORR(int32, mi_sint4korr, 4);
break;
case HA_KEYTYPE_ULONG_INT:
RT_AREA_INC_KORR(uint32, mi_uint4korr, 4);
break;
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG:
RT_AREA_INC_KORR(longlong, mi_sint8korr, 8);
break;
case HA_KEYTYPE_ULONGLONG:
RT_AREA_INC_KORR(longlong, mi_sint8korr, 8);
break;
#endif
case HA_KEYTYPE_FLOAT:
RT_AREA_INC_GET(float, mi_float4get, 4);
break;
case HA_KEYTYPE_DOUBLE:
RT_AREA_INC_GET(double, mi_float8get, 8);
break;
case HA_KEYTYPE_END:
return *ab_area - a_area;
default:
return -1;
}
keyseg_length= keyseg->length * 2;
key_length-= keyseg_length;
a+= keyseg_length;
b+= keyseg_length;
}
return *ab_area - a_area;
}
#define RT_PERIM_INC_KORR(type, korr_func, len) \
{ \
type amin, amax, bmin, bmax; \
amin = korr_func(a); \
bmin = korr_func(b); \
amax = korr_func(a+len); \
bmax = korr_func(b+len); \
a_perim+= (((double)amax) - ((double)amin)); \
*ab_perim+= ((double)max(amax, bmax) - (double)min(amin, bmin)); \
}
#define RT_PERIM_INC_GET(type, get_func, len)\
{\
type amin, amax, bmin, bmax; \
get_func(amin, a); \
get_func(bmin, b); \
get_func(amax, a+len); \
get_func(bmax, b+len); \
a_perim+= (((double)amax) - ((double)amin)); \
*ab_perim+= ((double)max(amax, bmax) - (double)min(amin, bmin)); \
}
/*
Calculates MBR_PERIMETER(a+b) - MBR_PERIMETER(a)
*/
double rtree_perimeter_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
uint key_length, double *ab_perim)
{
double a_perim = 0.0;
*ab_perim= 0.0;
for (; (int)key_length > 0; keyseg += 2)
{
uint32 keyseg_length;
if (keyseg->null_bit) /* Handle NULL part */
return -1;
switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_INT8:
RT_PERIM_INC_KORR(int8, mi_sint1korr, 1);
break;
case HA_KEYTYPE_BINARY:
RT_PERIM_INC_KORR(uint8, mi_uint1korr, 1);
break;
case HA_KEYTYPE_SHORT_INT:
RT_PERIM_INC_KORR(int16, mi_sint2korr, 2);
break;
case HA_KEYTYPE_USHORT_INT:
RT_PERIM_INC_KORR(uint16, mi_uint2korr, 2);
break;
case HA_KEYTYPE_INT24:
RT_PERIM_INC_KORR(int32, mi_sint3korr, 3);
break;
case HA_KEYTYPE_UINT24:
RT_PERIM_INC_KORR(int32, mi_uint3korr, 3);
break;
case HA_KEYTYPE_LONG_INT:
RT_PERIM_INC_KORR(int32, mi_sint4korr, 4);
break;
case HA_KEYTYPE_ULONG_INT:
RT_PERIM_INC_KORR(uint32, mi_uint4korr, 4);
break;
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG:
RT_PERIM_INC_KORR(longlong, mi_sint8korr, 8);
break;
case HA_KEYTYPE_ULONGLONG:
RT_PERIM_INC_KORR(longlong, mi_sint8korr, 8);
break;
#endif
case HA_KEYTYPE_FLOAT:
RT_PERIM_INC_GET(float, mi_float4get, 4);
break;
case HA_KEYTYPE_DOUBLE:
RT_PERIM_INC_GET(double, mi_float8get, 8);
break;
case HA_KEYTYPE_END:
return *ab_perim - a_perim;
default:
return -1;
}
keyseg_length= keyseg->length * 2;
key_length-= keyseg_length;
a+= keyseg_length;
b+= keyseg_length;
}
return *ab_perim - a_perim;
}
#define RT_PAGE_MBR_KORR(type, korr_func, store_func, len) \
{ \
type amin, amax, bmin, bmax; \
@ -649,7 +698,6 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
store_func(c, amax); \
c += len; \
inc += 2 * len; \
break; \
}
#define RT_PAGE_MBR_GET(type, get_func, store_func, len) \
@ -672,7 +720,6 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
store_func(c, amax); \
c += len; \
inc += 2 * len; \
break; \
}
/*
@ -700,61 +747,48 @@ int rtree_page_mbr(MI_INFO *info, HA_KEYSEG *keyseg, uchar *page_buf,
k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
switch ((enum ha_base_keytype) keyseg->type) {
case HA_KEYTYPE_TEXT:
case HA_KEYTYPE_BINARY:
case HA_KEYTYPE_VARTEXT:
case HA_KEYTYPE_VARBINARY:
case HA_KEYTYPE_NUM:
default:
return 1;
break;
case HA_KEYTYPE_INT8:
{
int amin, amax, bmin, bmax;
amin = (int)*((signed char *)(k + inc));
amax = (int)*((signed char *)(k + inc + 1));
k = rt_PAGE_NEXT_KEY(k, k_len, nod_flag);
for (; k < last; k = rt_PAGE_NEXT_KEY(k, k_len, nod_flag))
{
bmin = (int)*((signed char *)(k + inc));
bmax = (int)*((signed char *)(k + inc + 1));
if (amin > bmin)
amin = bmin;
if (amax < bmax)
amax = bmax;
}
*((signed char*)c) = amin;
c += 1;
*((signed char*)c) = amax;
c += 1;
inc += 1 * 2;
break;
}
RT_PAGE_MBR_KORR(int8, mi_sint1korr, mi_int1store, 1);
break;
case HA_KEYTYPE_BINARY:
RT_PAGE_MBR_KORR(uint8, mi_uint1korr, mi_int1store, 1);
break;
case HA_KEYTYPE_SHORT_INT:
RT_PAGE_MBR_KORR(int16, mi_sint2korr, mi_int2store, 2);
break;
case HA_KEYTYPE_USHORT_INT:
RT_PAGE_MBR_KORR(uint16, mi_uint2korr, mi_int2store, 2);
break;
case HA_KEYTYPE_INT24:
RT_PAGE_MBR_KORR(int32, mi_sint3korr, mi_int3store, 3);
break;
case HA_KEYTYPE_UINT24:
RT_PAGE_MBR_KORR(uint32, mi_uint3korr, mi_int3store, 3);
break;
case HA_KEYTYPE_LONG_INT:
RT_PAGE_MBR_KORR(int32, mi_sint4korr, mi_int4store, 4);
break;
case HA_KEYTYPE_ULONG_INT:
RT_PAGE_MBR_KORR(uint32, mi_uint4korr, mi_int4store, 4);
break;
#ifdef HAVE_LONG_LONG
case HA_KEYTYPE_LONGLONG:
RT_PAGE_MBR_KORR(longlong, mi_sint8korr, mi_int8store, 8);
break;
case HA_KEYTYPE_ULONGLONG:
RT_PAGE_MBR_KORR(ulonglong, mi_uint8korr, mi_int8store, 8);
break;
#endif
case HA_KEYTYPE_FLOAT:
RT_PAGE_MBR_GET(float, mi_float4get, mi_float4store, 4);
break;
case HA_KEYTYPE_DOUBLE:
RT_PAGE_MBR_GET(double, mi_float8get, mi_float8store, 8);
break;
case HA_KEYTYPE_END:
return 0;
default:
return 1;
}
}
return 0;

View file

@ -30,6 +30,8 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar *a, uchar *b,
uint key_length);
double rtree_area_increase(HA_KEYSEG *keyseg, uchar *a, uchar *b,
uint key_length, double *ab_area);
double rtree_perimeter_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
uint key_length, double *ab_perim);
int rtree_page_mbr(MI_INFO *info, HA_KEYSEG *keyseg, uchar *page_buf,
uchar* c, uint key_length);
#endif /*HAVE_RTREE_KEYS*/

View file

@ -267,12 +267,12 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
n_dim = keyinfo->keysegs / 2;
if (!my_multi_malloc(MYF(0),
&coord_buf, n_dim * 2 * sizeof(double) * (max_keys + 1 + 4),
&task, sizeof(SplitStruct) * (max_keys + 1),
NullS))
if (!(coord_buf= my_alloca(n_dim * 2 * sizeof(double) * (max_keys + 1 + 4) +
sizeof(SplitStruct) * (max_keys + 1))))
return -1;
task= (SplitStruct *)(coord_buf + n_dim * 2 * (max_keys + 1 + 4));
next_coord = coord_buf;
stop = task + max_keys;
@ -345,7 +345,7 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
my_afree((byte*)new_page);
split_err:
my_free((gptr) coord_buf, MYF(0));
my_afree((byte*) coord_buf);
return err_code;
}

View file

@ -34,6 +34,51 @@ static void create_record1(char *record,uint rownr);
static void print_record(char * record,my_off_t offs,const char * tail);
static int run_test(const char *filename);
static double rt_data[]=
{
/*1*/ 0,10,0,10,
/*2*/ 5,15,0,10,
/*3*/ 0,10,5,15,
/*4*/ 10,20,10,20,
/*5*/ 0,10,0,10,
/*6*/ 5,15,0,10,
/*7*/ 0,10,5,15,
/*8*/ 10,20,10,20,
/*9*/ 0,10,0,10,
/*10*/ 5,15,0,10,
/*11*/ 0,10,5,15,
/*12*/ 10,20,10,20,
/*13*/ 0,10,0,10,
/*14*/ 5,15,0,10,
/*15*/ 0,10,5,15,
/*16*/ 10,20,10,20,
/*17*/ 5,15,0,10,
/*18*/ 0,10,5,15,
/*19*/ 10,20,10,20,
/*20*/ 0,10,0,10,
/*1*/ 100,110,0,10,
/*2*/ 105,115,0,10,
/*3*/ 100,110,5,15,
/*4*/ 110,120,10,20,
/*5*/ 100,110,0,10,
/*6*/ 105,115,0,10,
/*7*/ 100,110,5,15,
/*8*/ 110,120,10,20,
/*9*/ 100,110,0,10,
/*10*/ 105,115,0,10,
/*11*/ 100,110,5,15,
/*12*/ 110,120,10,20,
/*13*/ 100,110,0,10,
/*14*/ 105,115,0,10,
/*15*/ 100,110,5,15,
/*16*/ 110,120,10,20,
/*17*/ 105,115,0,10,
/*18*/ 100,110,5,15,
/*19*/ 110,120,10,20,
/*20*/ 100,110,0,10,
-1
};
int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
{
@ -58,7 +103,7 @@ static int run_test(const char *filename)
int key_type=HA_KEYTYPE_DOUBLE;
int key_length=8;
int null_fields=0;
int nrecords=300;
int nrecords=sizeof(rt_data)/(sizeof(double)*4);/* 3000;*/
int rec_length=0;
int uniques=0;
int i;
@ -381,7 +426,7 @@ static void create_record1(char *record,uint rownr)
}
static void create_record(char *record,uint rownr)
static void create_record0(char *record,uint rownr)
{
int i;
char * pos;
@ -402,6 +447,19 @@ static void create_record(char *record,uint rownr)
}
}
static void create_record(char *record,uint rownr)
{
int i;
char *pos;
double *data= rt_data+rownr*4;
record[0]=0x01; /* DEL marker */
for ( pos=record+1, i=0; i<ndims*2; i++)
{
float8store(pos,data[i]);
pos+=8;
}
}
#else
int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
{

View file

@ -12,7 +12,7 @@ conflict with it.
All tests must pass. If one or more of them fail on your system, please
read the following manual section of how to report the problem:
http://www.mysql.com/doc/M/y/MySQL_test_suite.html
http://dev.mysql.com/doc/mysql/en/MySQL_test_suite.html
You can create your own test cases. To create a test case:

View file

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

View file

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

View file

@ -1417,7 +1417,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
# Kill any running ndbcluster stuff
./ndb/stop_ndbcluster
./ndb/ndbcluster --stop
fi
fi
@ -1438,7 +1438,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
echo "Starting ndbcluster"
./ndb/install_ndbcluster --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
./ndb/ndbcluster --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
export NDB_CONNECTSTRING=`cat Ndb.cfg`
else
export NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
@ -1538,7 +1538,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
# Kill any running ndbcluster stuff
./ndb/stop_ndbcluster
./ndb/ndbcluster --stop
fi
fi

View file

@ -2,13 +2,9 @@
benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test/ndb
test_SCRIPTS = \
install_ndbcluster \
stop_ndbcluster
test_SCRIPTS = ndbcluster
EXTRA_SCRIPTS = \
install_ndbcluster.sh \
stop_ndbcluster.sh
EXTRA_SCRIPTS = ndbcluster.sh
test_DATA = ndb_config_2_node.ini

View file

@ -9,27 +9,44 @@ port_base="22" # using ports port_base{"00","01", etc}
fsdir=`pwd`
# end configurable parameters
# Are we using a source or a binary distribution?
#BASEDIR is always one above mysql-test directory
CWD=`pwd`
cd ..
BASEDIR=`pwd`
cd $CWD
# Are we using a source or a binary distribution?
if [ -d ../sql ] ; then
SOURCE_DIST=1
ndbtop=`pwd`/../ndb
exec_ndb=$ndbtop/src/kernel/ndb-main/ndb
exec_mgmtsrvr=$ndbtop/src/mgmsrv/mgmtsrvr
ndbtop=$BASEDIR/ndb
exec_ndb=$ndbtop/src/kernel/ndbd
exec_mgmtsrvr=$ndbtop/src/mgmsrv/ndb_mgmd
exec_waiter=$ndbtop/tools/ndb_waiter
exec_mgmtclient=$ndbtop/src/mgmclient/mgmtclient
exec_mgmtclient=$ndbtop/src/mgmclient/ndb_mgm
else
BINARY_DIST=1
exec_ndb=@ndbbindir@/ndb
exec_mgmtsrvr=@ndbbindir@/mgmtsrvr
exec_waiter=@ndbtoolsdir@/ndb_waiter
exec_mgmtclient=@ndbbindir@/mgmtclient
if test -x "$BASEDIR/libexec/ndbd"
then
exec_ndb=$BASEDIR/libexec/ndbd
exec_mgmtsrvr=$BASEDIR/libexec/ndb_mgmd
else
exec_ndb=$BASEDIR/bin/ndbd
exec_mgmtsrvr=$BASEDIR/bin/ndb_mgmd
fi
exec_waiter=$BASEDIR/bin/ndb_waiter
exec_mgmtclient=$BASEDIR/bin/ndb_mgm
fi
pidfile=ndbcluster.pid
cfgfile=Ndb.cfg
stop_ndb=
initial_ndb=
while test $# -gt 0; do
case "$1" in
--stop)
stop_ndb=1
;;
--initial)
flags_ndb=$flags_ndb" -i"
initial_ndb=1
@ -112,7 +129,7 @@ sed \
> "$fs_mgm_1/config.ini"
fi
if ( cd $fs_mgm_1 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_mgmtsrvr -d -c config.ini ) ; then :; else
if ( cd $fs_mgm_1 ; echo $NDB_CONNECTSTRING > $cfgfile ; $exec_mgmtsrvr -d -c config.ini ) ; then :; else
echo "Unable to start $exec_mgmtsrvr from `pwd`"
exit 1
fi
@ -123,7 +140,7 @@ cat `find $fs_ndb -name 'node*.pid'` > $pidfile
NDB_ID="2"
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
( cd $fs_ndb_2 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_ndb -d $flags_ndb & )
( cd $fs_ndb_2 ; echo $NDB_CONNECTSTRING > $cfgfile ; $exec_ndb -d $flags_ndb & )
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
@ -131,7 +148,7 @@ cat `find $fs_ndb -name 'node*.pid'` > $pidfile
NDB_ID="3"
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
( cd $fs_ndb_3 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_ndb -d $flags_ndb & )
( cd $fs_ndb_3 ; echo $NDB_CONNECTSTRING > $cfgfile ; $exec_ndb -d $flags_ndb & )
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
@ -149,11 +166,45 @@ if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
exit 1
fi
echo $NDB_CONNECTSTRING > Ndb.cfg
echo $NDB_CONNECTSTRING > $cfgfile
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
}
start_default_ndbcluster
stop_default_ndbcluster() {
#if [ ! -f $pidfile ] ; then
# exit 0
#fi
if [ ! -f $cfgfile ] ; then
echo "$cfgfile missing"
exit 1
fi
ndb_host=`cat $cfgfile | sed -e "s,.*host=\(.*\)\:.*,\1,1"`
ndb_port=`cat $cfgfile | sed -e "s,.*host=$ndb_host\:\([0-9]*\).*,\1,1"`
# Start management client
exec_mgmtclient="$exec_mgmtclient --try-reconnect=1 $ndb_host $ndb_port"
echo "$exec_mgmtclient"
echo "all stop" | $exec_mgmtclient
sleep 5
if [ -f $pidfile ] ; then
kill `cat $pidfile`
rm $pidfile
fi
}
if [ $stop_ndb ] ; then
stop_default_ndbcluster
else
start_default_ndbcluster
fi
exit 0

View file

@ -1,63 +0,0 @@
#!/bin/sh
# Copyright (C) 2004 MySQL AB
# For a more info consult the file COPYRIGHT distributed with this file
# This scripts stops the table handler ndbcluster
if [ -d ../sql ] ; then
SOURCE_DIST=1
ndbtop=`pwd`/../ndb
exec_mgmtclient=$ndbtop/src/mgmclient/mgmtclient
else
BINARY_DIST=1
exec_mgmtclient=@ndbbindir@/mgmtclient
fi
pidfile=ndbcluster.pid
cfgfile=Ndb.cfg
while test $# -gt 0; do
case "$1" in
--port-base=*)
port_base=`echo "$1" | sed -e "s;--port-base=;;"`
;;
-- ) shift; break ;;
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
* ) break ;;
esac
shift
done
stop_default_ndbcluster() {
#if [ ! -f $pidfile ] ; then
# exit 0
#fi
if [ ! -f $cfgfile ] ; then
echo "$cfgfile missing"
exit 1
fi
ndb_host=`cat $cfgfile | sed -e "s,.*host=\(.*\)\:.*,\1,1"`
ndb_port=`cat $cfgfile | sed -e "s,.*host=$ndb_host\:\([0-9]*\).*,\1,1"`
# Start management client
exec_mgmtclient="$exec_mgmtclient --try-reconnect=1 $ndb_host $ndb_port"
echo "$exec_mgmtclient"
echo "all stop" | $exec_mgmtclient
sleep 5
if [ -f $pidfile ] ; then
kill `cat $pidfile`
rm $pidfile
fi
}
stop_default_ndbcluster
exit 0

1396
mysql-test/r/archive.result Normal file

File diff suppressed because it is too large Load diff

View file

@ -47,6 +47,15 @@ t1 CREATE TABLE `t1` (
`r` char(10) character set ucs2 NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
create table t2(f1 Char(30));
insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");
select lpad(f1, 12, "-o-/") from t2;
lpad(f1, 12, "-o-/")
-o-/-o103000
-o-/22720000
-o-/-3401200
-o-/-o-78000
drop table t2;
SET NAMES koi8r;
SET character_set_connection=ucs2;
create table t1 (a varchar(10) character set ucs2, key(a));

View file

@ -111,3 +111,18 @@ no index
drop table t1;
CREATE TABLE t1 (
a char(1) NOT NULL default '',
b enum('あ','い') default NULL
) CHARACTER SET ujis;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(1) NOT NULL default '',
`b` enum('あ','い') default NULL
) ENGINE=MyISAM DEFAULT CHARSET=ujis
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
a char(1)
b enum('あ','い') YES NULL
DROP TABLE t1;

View file

@ -218,3 +218,25 @@ b
select * from t1 where a = 'b' and a != 'b';
a
drop table t1;
set names utf8;
select 'вася' rlike '[[:<:]]вася[[:>:]]';
'вася' rlike '[[:<:]]вася[[:>:]]'
1
select 'вася ' rlike '[[:<:]]вася[[:>:]]';
'вася ' rlike '[[:<:]]вася[[:>:]]'
1
select ' вася' rlike '[[:<:]]вася[[:>:]]';
' вася' rlike '[[:<:]]вася[[:>:]]'
1
select ' вася ' rlike '[[:<:]]вася[[:>:]]';
' вася ' rlike '[[:<:]]вася[[:>:]]'
1
select 'васяz' rlike '[[:<:]]вася[[:>:]]';
асяz' rlike '[[:<:]]вася[[:>:]]'
0
select 'zвася' rlike '[[:<:]]вася[[:>:]]';
'zвася' rlike '[[:<:]]вася[[:>:]]'
0
select 'zвасяz' rlike '[[:<:]]вася[[:>:]]';
'zвасяz' rlike '[[:<:]]вася[[:>:]]'
0

View file

@ -172,7 +172,7 @@ create table t1 ( URL_ID int(11), URL varchar(80));
create table t2 ( REQ_ID int(11), URL_ID int(11));
insert into t1 values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com');
insert into t2 values (1,4), (5,4), (5,5);
select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
t2.URL_ID = t1.URL_ID group by REQ_ID;
REQ_ID URL
1 X

View file

@ -528,6 +528,9 @@ latin2_general_ci 3
select collation(replace(_latin2'abcd',_latin2'b',_latin2'B')), coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'));
collation(replace(_latin2'abcd',_latin2'b',_latin2'B')) coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'))
latin2_general_ci 3
select collation(encode('abcd','ab')), coercibility(encode('abcd','ab'));
collation(encode('abcd','ab')) coercibility(encode('abcd','ab'))
binary 3
create table t1
select
bin(130),
@ -559,7 +562,8 @@ quote(_latin2'ab'),
soundex(_latin2'ab'),
substring(_latin2'ab',1),
insert(_latin2'abcd',2,3,_latin2'ef'),
replace(_latin2'abcd',_latin2'b',_latin2'B')
replace(_latin2'abcd',_latin2'b',_latin2'B'),
encode('abcd','ab')
;
Warnings:
Warning 1265 Data truncated for column 'format(130,10)' at row 1
@ -595,7 +599,8 @@ t1 CREATE TABLE `t1` (
`soundex(_latin2'ab')` char(4) character set latin2 NOT NULL default '',
`substring(_latin2'ab',1)` char(2) character set latin2 NOT NULL default '',
`insert(_latin2'abcd',2,3,_latin2'ef')` char(6) character set latin2 NOT NULL default '',
`replace(_latin2'abcd',_latin2'b',_latin2'B')` char(4) character set latin2 NOT NULL default ''
`replace(_latin2'abcd',_latin2'b',_latin2'B')` char(4) character set latin2 NOT NULL default '',
`encode('abcd','ab')` binary(4) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select SUBSTR('abcdefg',3,2);

View file

@ -167,12 +167,10 @@ count(*)
150
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range g g 32 NULL 4 Using where
1 SIMPLE t1 range g g 32 NULL 7 Using where
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
fid AsText(g)
1 LINESTRING(150 150,150 150)
11 LINESTRING(140 140,160 160)
2 LINESTRING(149 149,151 151)
3 LINESTRING(148 148,152 152)
4 LINESTRING(147 147,153 153)
5 LINESTRING(146 146,154 154)
@ -181,6 +179,8 @@ fid AsText(g)
8 LINESTRING(143 143,157 157)
9 LINESTRING(142 142,158 158)
10 LINESTRING(141 141,159 159)
11 LINESTRING(140 140,160 160)
2 LINESTRING(149 149,151 151)
DROP TABLE t1;
CREATE TABLE t2 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@ -305,10 +305,10 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
fid AsText(g)
46 LINESTRING(51 41,60 50)
56 LINESTRING(41 41,50 50)
45 LINESTRING(51 51,60 60)
55 LINESTRING(41 51,50 60)
56 LINESTRING(41 41,50 50)
46 LINESTRING(51 41,60 50)
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)

View file

@ -0,0 +1,2 @@
Variable_name Value
have_archive YES

View file

@ -0,0 +1,2 @@
Variable_name Value
have_geometry YES

View file

@ -1,5 +1,5 @@
drop table if exists t1,t2;
set timestamp=1000000000;
drop table if exists t1,t2;
create table t1 (word varchar(20));
create table t2 (id int auto_increment not null primary key);
insert into t1 values ("abirvalg");
@ -17,6 +17,8 @@ flush logs;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1000000000;
drop table if exists t1,t2;
SET TIMESTAMP=1000000000;
create table t1 (word varchar(20));
SET TIMESTAMP=1000000000;
create table t2 (id int auto_increment not null primary key);
@ -51,6 +53,8 @@ insert into t1 values ("Alas");
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1000000000;
drop table if exists t1,t2;
SET TIMESTAMP=1000000000;
create table t1 (word varchar(20));
SET TIMESTAMP=1000000000;
create table t2 (id int auto_increment not null primary key);

View file

@ -54,7 +54,10 @@ CREATE TABLE `t1` (
);
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
@ -75,6 +78,8 @@ UNLOCK TABLES;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
@ -138,7 +143,10 @@ DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
@ -158,6 +166,8 @@ UNLOCK TABLES;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
DROP TABLE t1;
CREATE TABLE t1 (a int) ENGINE=MYISAM;
@ -208,7 +218,10 @@ CREATE TABLE ```a` (
drop table ```a`;
create table t1(a int);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
@ -227,6 +240,8 @@ UNLOCK TABLES;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
@ -248,7 +263,10 @@ UNLOCK TABLES;
set global sql_mode='ANSI_QUOTES';
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
@ -267,6 +285,8 @@ UNLOCK TABLES;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
@ -291,7 +311,10 @@ drop table t1;
create table t1(a int);
insert into t1 values (1),(2),(3);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="" */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
@ -301,6 +324,8 @@ CREATE TABLE `t1` (
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
1
2

115
mysql-test/r/ps.result Normal file
View file

@ -0,0 +1,115 @@
drop table if exists t1,t2;
create table t1
(
a int primary key,
b char(10)
);
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
set @a=2;
prepare stmt1 from 'select * from t1 where a <= ?';
execute stmt1 using @a;
a b
1 one
2 two
set @a=3;
execute stmt1 using @a;
a b
1 one
2 two
3 three
deallocate prepare no_such_statement;
ERROR HY000: Unknown prepared statement handler (no_such_statement) given to DEALLOCATE PREPARE
execute stmt1;
ERROR HY000: Wrong arguments to EXECUTE
prepare stmt2 from 'prepare nested_stmt from "select 1"';
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '"select 1"' at line 1
prepare stmt2 from 'execute stmt1';
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'stmt1' at line 1
prepare stmt2 from 'deallocate prepare z';
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'z' at line 1
prepare stmt3 from 'insert into t1 values (?,?)';
set @arg1=5, @arg2='five';
execute stmt3 using @arg1, @arg2;
select * from t1 where a>3;
a b
4 four
5 five
prepare stmt4 from 'update t1 set a=? where b=?';
set @arg1=55, @arg2='five';
execute stmt4 using @arg1, @arg2;
select * from t1 where a>3;
a b
4 four
55 five
prepare stmt4 from 'create table t2 (a int)';
execute stmt4;
prepare stmt4 from 'drop table t2';
execute stmt4;
execute stmt4;
ERROR 42S02: Unknown table 't2'
prepare stmt5 from 'select ? + a from t1';
set @a=1;
execute stmt5 using @a;
? + a
2
3
4
5
56
execute stmt5 using @no_such_var;
? + a
NULL
NULL
NULL
NULL
NULL
set @nullvar=1;
set @nullvar=NULL;
execute stmt5 using @nullvar;
? + a
NULL
NULL
NULL
NULL
NULL
set @nullvar2=NULL;
execute stmt5 using @nullvar2;
? + a
NULL
NULL
NULL
NULL
NULL
prepare stmt6 from 'select 1; select2';
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '; select2' at line 1
prepare stmt6 from 'insert into t1 values (5,"five"); select2';
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '; select2' at line 1
explain prepare stmt6 from 'insert into t1 values (5,"five"); select2';
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'from 'insert into t1 values (5,"five"); select2'' at line 1
create table t2
(
a int
);
insert into t2 values (0);
set @arg00=NULL ;
prepare stmt1 from 'select 1 FROM t2 where a=?' ;
execute stmt1 using @arg00 ;
1
prepare stmt1 from @nosuchvar;
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1
set @ivar= 1234;
prepare stmt1 from @ivar;
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '1234' at line 1
set @fvar= 123.4567;
prepare stmt1 from @fvar;
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '123.4567' at line 1
set @str1 = 'select ?';
set @str2 = convert(@str1 using ucs2);
prepare stmt1 from @str2;
execute stmt1 using @ivar;
?
1234
drop table t1,t2;

View file

@ -0,0 +1,201 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop database if exists test2;
drop database if exists test3;
create database test2 character set latin2;
set @@character_set_server=latin5;
create database test3;
--- --master--
show create database test2;
Database Create Database
test2 CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET latin2 */
show create database test3;
Database Create Database
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET latin5 */
--- --slave--
show create database test2;
Database Create Database
test2 CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET latin2 */
show create database test3;
Database Create Database
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET latin5 */
set @@collation_server=armscii_bin;
drop database test3;
create database test3;
--- --master--
show create database test3;
Database Create Database
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii_bin */
--- --slave--
show create database test3;
Database Create Database
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii_bin */
use test2;
create table t1 (a int auto_increment primary key, b varchar(100));
set character_set_client=cp850, collation_connection=latin2_croatian_ci;
insert into t1 (b) values(@@character_set_server);
insert into t1 (b) values(@@collation_server);
insert into t1 (b) values(@@character_set_client);
insert into t1 (b) values(@@character_set_connection);
insert into t1 (b) values(@@collation_connection);
--- --master--
select * from t1 order by a;
a b
1 armscii8
2 armscii_bin
3 cp850
4 latin2
5 latin2_croatian_ci
--- --slave--
select * from test2.t1 order by a;
a b
1 armscii8
2 armscii_bin
3 cp850
4 latin2
5 latin2_croatian_ci
set character_set_client=latin1, collation_connection=latin1_german1_ci;
truncate table t1;
insert into t1 (b) values(@@collation_connection);
insert into t1 (b) values(LEAST("Müller","Muffler"));
set collation_connection=latin1_german2_ci;
insert into t1 (b) values(@@collation_connection);
insert into t1 (b) values(LEAST("Müller","Muffler"));
--- --master--
select * from t1 order by a;
a b
1 latin1_german1_ci
2 Muffler
3 latin1_german2_ci
4 Müller
--- --slave--
select * from test2.t1 order by a;
a b
1 latin1_german1_ci
2 Muffler
3 latin1_german2_ci
4 Müller
load data infile '../../std_data/words.dat' into table t1 (b);
set @a= _cp850 'Müller' collate cp850_general_ci;
truncate table t1;
insert into t1 (b) values(collation(@a));
--- --master--
select * from t1 order by a;
a b
1 cp850_general_ci
--- --slave--
select * from test2.t1 order by a;
a b
1 cp850_general_ci
drop database test2;
drop database test3;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 Query 1 79 use `test`; drop database if exists test2
master-bin.000001 143 Query 1 143 use `test`; drop database if exists test3
master-bin.000001 207 Query 1 207 use `test`; create database test2 character set latin2
master-bin.000001 284 Query 1 284 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30
master-bin.000001 418 Query 1 418 use `test`; create database test3
master-bin.000001 474 Query 1 474 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 608 Query 1 608 use `test`; drop database test3
master-bin.000001 662 Query 1 662 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 796 Query 1 796 use `test`; create database test3
master-bin.000001 852 Query 1 852 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 987 Query 1 987 use `test2`; create table t1 (a int auto_increment primary key, b varchar(100))
master-bin.000001 1089 Query 1 1089 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1225 Intvar 1 1225 INSERT_ID=1
master-bin.000001 1253 Query 1 1253 use `test2`; insert into t1 (b) values(@@character_set_server)
master-bin.000001 1338 Query 1 1338 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1474 Intvar 1 1474 INSERT_ID=2
master-bin.000001 1502 Query 1 1502 use `test2`; insert into t1 (b) values(@@collation_server)
master-bin.000001 1583 Query 1 1583 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1719 Intvar 1 1719 INSERT_ID=3
master-bin.000001 1747 Query 1 1747 use `test2`; insert into t1 (b) values(@@character_set_client)
master-bin.000001 1832 Query 1 1832 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1968 Intvar 1 1968 INSERT_ID=4
master-bin.000001 1996 Query 1 1996 use `test2`; insert into t1 (b) values(@@character_set_connection)
master-bin.000001 2085 Query 1 2085 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2221 Intvar 1 2221 INSERT_ID=5
master-bin.000001 2249 Query 1 2249 use `test2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 2334 Query 1 2334 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2469 Query 1 2469 use `test2`; truncate table t1
master-bin.000001 2522 Query 1 2522 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2657 Intvar 1 2657 INSERT_ID=1
master-bin.000001 2685 Query 1 2685 use `test2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 2770 Query 1 2770 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2905 Intvar 1 2905 INSERT_ID=2
master-bin.000001 2933 Query 1 2933 use `test2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
master-bin.000001 3021 Query 1 3021 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3157 Intvar 1 3157 INSERT_ID=3
master-bin.000001 3185 Query 1 3185 use `test2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 3270 Query 1 3270 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3406 Intvar 1 3406 INSERT_ID=4
master-bin.000001 3434 Query 1 3434 use `test2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
master-bin.000001 3522 Query 1 3522 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3658 Intvar 1 3658 INSERT_ID=74
master-bin.000001 3686 Create_file 1 3686 db=test2;table=t1;file_id=1;block_len=581
master-bin.000001 4354 Query 1 4354 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4490 Intvar 1 4490 INSERT_ID=5
master-bin.000001 4518 Exec_load 1 4518 ;file_id=1
master-bin.000001 4541 Query 1 4541 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4677 Query 1 4677 use `test2`; truncate table t1
master-bin.000001 4730 Query 1 4730 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4866 Intvar 1 4866 INSERT_ID=1
master-bin.000001 4894 User var 1 4894 @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
master-bin.000001 4934 Query 1 4934 use `test2`; insert into t1 (b) values(collation(@a))
master-bin.000001 5010 Query 1 5010 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 5146 Query 1 5146 use `test2`; drop database test2
master-bin.000001 5201 Query 1 5201 SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 5332 Query 1 5332 drop database test3
set global character_set_server=latin2;
ERROR HY000: Binary logging and replication forbid changing the global server character set or collation
set global character_set_server=latin2;
ERROR HY000: Binary logging and replication forbid changing the global server character set or collation
set one_shot @@character_set_server=latin5;
set @@max_join_size=1000;
select @@character_set_server;
@@character_set_server
latin5
select @@character_set_server;
@@character_set_server
latin1
set @@character_set_server=latin5;
select @@character_set_server;
@@character_set_server
latin5
select @@character_set_server;
@@character_set_server
latin5
set one_shot max_join_size=10;
ERROR HY000: The SET ONE_SHOT syntax is reserved for purposes internal to the MySQL server
set character_set_client=9999999;
ERROR 42000: Unknown character set: '9999999'
set collation_server=9999998;
ERROR HY000: Unknown collation: '9999998'
use test;
CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
SET CHARACTER_SET_CLIENT=koi8r,
CHARACTER_SET_CONNECTION=cp1251,
CHARACTER_SET_RESULTS=koi8r;
INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ');
select hex(c1), hex(c2) from t1;
hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
select hex(c1), hex(c2) from t1;
hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
drop table t1;

View file

@ -0,0 +1,31 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create database test1;
drop database if exists test1;
Warnings:
Note 1008 Can't drop database 'test1'; database doesn't exist
show tables from test1;
ERROR HY000: Can't read dir of './test1/' (Errcode: 2)
create table t1 (a int);
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist
create table t1 (a int);
insert into t1 values(1);
delete from t1;
select * from t1;
a
insert into t1 values(1);
insert into t1 values(2);
update t1 set a=2;
select * from t1;
a
2
2
drop table t1;

View file

@ -14,4 +14,4 @@ start slave;
flush logs;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 79 relay-log.000002 4 slave-bin.000001 Yes Yes 0 0 79 4 None 0 No #
# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 161 relay-log.000002 4 slave-bin.000001 Yes Yes 0 0 161 4 None 0 No #

View file

@ -0,0 +1,28 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop table if exists t1;
create table t1(n char(30));
prepare stmt1 from 'insert into t1 values (?)';
set @var1= "from-master-1";
execute stmt1 using @var1;
set @var1= "from-master-2-'',";
execute stmt1 using @var1;
select * from t1;
n
from-master-1
from-master-2-'',
set @var2= 'insert into t1 values (concat("from-var-", ?))';
prepare stmt2 from @var2;
set @var1='from-master-3';
execute stmt2 using @var1;
select * from t1;
n
from-master-1
from-master-2-'',
from-var-from-master-3
drop table t1;
stop slave;

View file

@ -28,4 +28,4 @@ ERROR 42S02: Table 'test.t11' doesn't exist
drop table if exists t1,t2,t11;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1281 slave-relay-bin.000002 1325 master-bin.000001 Yes Yes test.t1 0 0 1281 1325 None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1340 slave-relay-bin.000002 1384 master-bin.000001 Yes Yes test.t1 0 0 1340 1384 None 0 No #

View file

@ -15,8 +15,5 @@ start slave;
insert into t1 values (1);
show status like "slave_running";
Variable_name Value
Slave_running ON
select * from t1;
n
1
Slave_running OFF
drop table t1;

View file

@ -39,17 +39,18 @@ f
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.000001 79 Query 1 79 use `test`; create table t1(f int)
master-bin.000001 136 Query 1 136 use `test`; create table t2(f int)
master-bin.000001 193 Query 1 193 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
master-bin.000001 290 Query 1 290 use `test`; create temporary table t3(f int)
master-bin.000001 357 Query 1 357 use `test`; insert into t3 select * from t1 where f<6
master-bin.000001 433 Query 1 433 use `test`; create temporary table t3(f int)
master-bin.000001 500 Query 1 500 use `test`; insert into t2 select count(*) from t3
master-bin.000001 573 Query 1 573 use `test`; insert into t3 select * from t1 where f>=4
master-bin.000001 650 Query 1 650 use `test`; drop temporary table t3
master-bin.000001 708 Query 1 708 use `test`; insert into t2 select count(*) from t3
master-bin.000001 781 Query 1 781 use `test`; drop temporary table t3
master-bin.000001 79 Query 1 79 use `test`; drop table if exists t1,t2
master-bin.000001 140 Query 1 140 use `test`; create table t1(f int)
master-bin.000001 197 Query 1 197 use `test`; create table t2(f int)
master-bin.000001 254 Query 1 254 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
master-bin.000001 351 Query 1 351 use `test`; create temporary table t3(f int)
master-bin.000001 418 Query 1 418 use `test`; insert into t3 select * from t1 where f<6
master-bin.000001 494 Query 1 494 use `test`; create temporary table t3(f int)
master-bin.000001 561 Query 1 561 use `test`; insert into t2 select count(*) from t3
master-bin.000001 634 Query 1 634 use `test`; insert into t3 select * from t1 where f>=4
master-bin.000001 711 Query 1 711 use `test`; drop temporary table t3
master-bin.000001 769 Query 1 769 use `test`; insert into t2 select count(*) from t3
master-bin.000001 842 Query 1 842 use `test`; drop temporary table t3
drop table t1, t2;
use test;
SET TIMESTAMP=1040323920;

View file

@ -78,32 +78,32 @@ NULL
NULL
show binlog events from 141;
Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.000001 141 User var 2 141 @i1=12345678901234
slave-bin.000001 184 User var 2 184 @i2=-12345678901234
slave-bin.000001 227 User var 2 227 @i3=0
slave-bin.000001 270 User var 2 270 @i4=-1
slave-bin.000001 141 User var 2 141 @`i1`=12345678901234
slave-bin.000001 184 User var 2 184 @`i2`=-12345678901234
slave-bin.000001 227 User var 2 227 @`i3`=0
slave-bin.000001 270 User var 2 270 @`i4`=-1
slave-bin.000001 313 Query 1 313 use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4)
slave-bin.000001 396 User var 2 396 @r1=12.5
slave-bin.000001 439 User var 2 439 @r2=-12.5
slave-bin.000001 396 User var 2 396 @`r1`=12.5
slave-bin.000001 439 User var 2 439 @`r2`=-12.5
slave-bin.000001 482 Query 1 482 use `test`; insert into t1 values (@r1), (@r2)
slave-bin.000001 551 User var 2 551 @s1='This is a test'
slave-bin.000001 600 User var 2 600 @s2=''
slave-bin.000001 635 User var 2 635 @s3='abc'def'
slave-bin.000001 677 User var 2 677 @s4='abc\def'
slave-bin.000001 719 User var 2 719 @s5='abc'def'
slave-bin.000001 551 User var 2 551 @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
slave-bin.000001 600 User var 2 600 @`s2`=_latin1 "" COLLATE latin1_swedish_ci
slave-bin.000001 635 User var 2 635 @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
slave-bin.000001 677 User var 2 677 @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
slave-bin.000001 719 User var 2 719 @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
slave-bin.000001 761 Query 1 761 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
slave-bin.000001 851 User var 2 851 @n1=NULL
slave-bin.000001 851 User var 2 851 @`n1`=NULL
slave-bin.000001 877 Query 1 877 use `test`; insert into t1 values (@n1)
slave-bin.000001 939 User var 2 939 @n2=NULL
slave-bin.000001 939 User var 2 939 @`n2`=NULL
slave-bin.000001 965 Query 1 965 use `test`; insert into t1 values (@n2)
slave-bin.000001 1027 Query 1 1027 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
slave-bin.000001 1115 User var 2 1115 @a=2
slave-bin.000001 1115 User var 2 1115 @`a`=2
slave-bin.000001 1157 Query 1 1157 use `test`; insert into t1 values (@a+(@b:=@a+1))
slave-bin.000001 1229 User var 2 1229 @q='abc'
slave-bin.000001 1229 User var 2 1229 @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
slave-bin.000001 1266 Query 1 1266 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
slave-bin.000001 1370 User var 2 1370 @a=5
slave-bin.000001 1370 User var 2 1370 @`a`=5
slave-bin.000001 1412 Query 1 1412 use `test`; insert into t1 values (@a),(@a)
slave-bin.000001 1478 User var 2 1478 @a=NULL
slave-bin.000001 1478 User var 2 1478 @`a`=NULL
slave-bin.000001 1503 Query 1 1503 use `test`; insert into t1 values (@a),(@a),(@a*5)
drop table t1;
stop slave;

View file

@ -226,3 +226,20 @@ WHERE ( r = 1 AND a IN ( 1, 2 ) AND ( u = 'w' OR u LIKE 'w/%' ) )
OR ( r = 1 AND a IN ( 3 ) AND ( u = 'w/U' OR u LIKE 'w/U/%' ) )
OR ( r = 1 AND a IN ( 1, 2, 3 ) AND ( u = 'w' ) );
drop table t1;
CREATE TABLE t1 (a VARCHAR(16), UNIQUE(a));
INSERT INTO t1 VALUES ('1'), ('2'), ('3');
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = '2' LIMIT 0, 1;
a
2
SELECT FOUND_ROWS();
FOUND_ROWS()
1
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (0), (0), (1), (2);
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = 0 GROUP BY a HAVING a > 10;
a
SELECT FOUND_ROWS();
FOUND_ROWS()
0
DROP TABLE t1;

View file

@ -162,3 +162,36 @@ charset(@a) collation(@a) coercibility(@a)
latin2 latin2_bin 0
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
ERROR HY000: Illegal mix of collations (latin2_bin,EXPLICIT) and (latin2_general_ci,EXPLICIT) for operation '='
create table t1 (a varchar(50));
reset master;
SET TIMESTAMP=10000;
SET @`a b`='hello';
INSERT INTO t1 VALUES(@`a b`);
set @var1= "';aaa";
insert into t1 values (@var1);
create table t2 (c char(30)) charset=ucs2;
set @v=convert('abc' using ucs2);
insert into t2 values (@v);
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 User var 1 79 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
master-bin.000001 120 Query 1 120 use `test`; INSERT INTO t1 VALUES(@`a b`)
master-bin.000001 184 User var 1 184 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
master-bin.000001 226 Query 1 226 use `test`; insert into t1 values (@var1)
master-bin.000001 290 Query 1 290 use `test`; create table t2 (c char(30)) charset=ucs2
master-bin.000001 366 User var 1 366 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
master-bin.000001 406 Query 1 406 use `test`; insert into t2 values (@v)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET @`a b`:=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci;
use test;
SET TIMESTAMP=10000;
INSERT INTO t1 VALUES(@`a b`);
SET @`var1`:=_latin1 0x273B616161 COLLATE latin1_swedish_ci;
SET TIMESTAMP=10000;
insert into t1 values (@var1);
SET TIMESTAMP=10000;
create table t2 (c char(30)) charset=ucs2;
SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci;
SET TIMESTAMP=10000;
insert into t2 values (@v);
drop table t1, t2;

1300
mysql-test/t/archive.test Normal file

File diff suppressed because it is too large Load diff

View file

@ -47,6 +47,16 @@ LPAD(_ucs2 X'0420',10,_ucs2 X'0421') l,
RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
SHOW CREATE TABLE t1;
DROP TABLE t1;
#
# BUG3946
#
create table t2(f1 Char(30));
insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");
select lpad(f1, 12, "-o-/") from t2;
drop table t2;
######################################################
#
# Test of like

View file

@ -73,3 +73,13 @@ create index idx_c1 on t1(c1);
select c1 as 'using index' from t1 where c1 like cast(concat(0xA4A2, '%') as char character set ujis);
select c1 as 'no index' from t1 where c1 like cast(concat('%',0xA4A2, '%') as char character set ujis);
drop table t1;
# Bug 2077
CREATE TABLE t1 (
a char(1) NOT NULL default '',
b enum('¤¢','¤¤') default NULL
) CHARACTER SET ujis;
SHOW CREATE TABLE t1;
SHOW COLUMNS FROM t1;
DROP TABLE t1;

View file

@ -141,3 +141,19 @@ select * from t1 where a = 'b';
select * from t1 where a = 'b' and a = 'b';
select * from t1 where a = 'b' and a != 'b';
drop table t1;
#
# Bug #3928 regexp [[:>:]] and UTF-8
#
set names utf8;
# This should return TRUE
select 'вася' rlike '[[:<:]]вася[[:>:]]';
select 'вася ' rlike '[[:<:]]вася[[:>:]]';
select ' вася' rlike '[[:<:]]вася[[:>:]]';
select ' вася ' rlike '[[:<:]]вася[[:>:]]';
# This should return FALSE
select 'васяz' rlike '[[:<:]]вася[[:>:]]';
select 'zвася' rlike '[[:<:]]вася[[:>:]]';
select 'zвасяz' rlike '[[:<:]]вася[[:>:]]';

View file

@ -83,7 +83,7 @@ insert into t1 values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com'
insert into t2 values (1,4), (5,4), (5,5);
# Make this order independent
--replace_result www.help.com X www.host.com X www.google.com X
select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
t2.URL_ID = t1.URL_ID group by REQ_ID;
# check min/max function
--replace_result www.help.com X www.host.com X www.google.com X
@ -132,7 +132,7 @@ drop table t1, t2;
CREATE TABLE t1 (id1 tinyint(4) NOT NULL, id2 tinyint(4) NOT NULL);
INSERT INTO t1 VALUES (1, 1),(1, 2),(1, 3),(1, 4),(1, 5),(2, 1),(2, 2),(2, 3);
CREATE TABLE t2 (id1 tinyint(4) NOT NULL);
CREATE TABLE t2 (id1 tinyint(4) NOT NULL);
INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 AND t1.id1=1 GROUP BY t1.id1;
SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
@ -163,7 +163,7 @@ drop table t1;
# Test with subqueries (Bug #3319)
#
create table t1 (a int, c int);
create table t1 (a int, c int);
insert into t1 values (1, 2), (2, 3), (2, 4), (3, 5);
create table t2 (a int, c int);
insert into t2 values (1, 5), (2, 4), (3, 3), (3,3);

View file

@ -304,6 +304,7 @@ select collation(soundex(_latin2'ab')), coercibility(soundex(_latin2'ab'));
select collation(substring(_latin2'ab',1)), coercibility(substring(_latin2'ab',1));
select collation(insert(_latin2'abcd',2,3,_latin2'ef')), coercibility(insert(_latin2'abcd',2,3,_latin2'ef'));
select collation(replace(_latin2'abcd',_latin2'b',_latin2'B')), coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'));
select collation(encode('abcd','ab')), coercibility(encode('abcd','ab'));
create table t1
select
@ -336,7 +337,8 @@ select
soundex(_latin2'ab'),
substring(_latin2'ab',1),
insert(_latin2'abcd',2,3,_latin2'ef'),
replace(_latin2'abcd',_latin2'b',_latin2'B')
replace(_latin2'abcd',_latin2'b',_latin2'B'),
encode('abcd','ab')
;
show create table t1;
drop table t1;

View file

@ -1,3 +1,5 @@
-- source include/have_geometry.inc
#
# test of rtree (using with spatial data)
#

View file

@ -1,3 +1,5 @@
-- source include/have_geometry.inc
#
# Spatial objects
#

View file

@ -1,11 +1,12 @@
# We are using .opt file since we need small binlog size
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
# we need this for getting fixed timestamps inside of this test
set timestamp=1000000000;
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
create table t1 (word varchar(20));
create table t2 (id int auto_increment not null primary key);

119
mysql-test/t/ps.test Normal file
View file

@ -0,0 +1,119 @@
#
# SQL Syntax for Prepared Statements test
#
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
create table t1
(
a int primary key,
b char(10)
);
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
# basic functionality
set @a=2;
prepare stmt1 from 'select * from t1 where a <= ?';
execute stmt1 using @a;
set @a=3;
execute stmt1 using @a;
# non-existant statement
--error 1243
deallocate prepare no_such_statement;
--error 1210
execute stmt1;
# Nesting ps commands is not allowed:
--error 1064
prepare stmt2 from 'prepare nested_stmt from "select 1"';
--error 1064
prepare stmt2 from 'execute stmt1';
--error 1064
prepare stmt2 from 'deallocate prepare z';
# PS insert
prepare stmt3 from 'insert into t1 values (?,?)';
set @arg1=5, @arg2='five';
execute stmt3 using @arg1, @arg2;
select * from t1 where a>3;
# PS update
prepare stmt4 from 'update t1 set a=? where b=?';
set @arg1=55, @arg2='five';
execute stmt4 using @arg1, @arg2;
select * from t1 where a>3;
# PS create/delete
prepare stmt4 from 'create table t2 (a int)';
execute stmt4;
prepare stmt4 from 'drop table t2';
execute stmt4;
# Do something that will cause error
--error 1051
execute stmt4;
# placeholders in result field names.
prepare stmt5 from 'select ? + a from t1';
set @a=1;
execute stmt5 using @a;
execute stmt5 using @no_such_var;
set @nullvar=1;
set @nullvar=NULL;
execute stmt5 using @nullvar;
set @nullvar2=NULL;
execute stmt5 using @nullvar2;
# Check that multiple SQL statements are disabled inside PREPARE
--error 1064
prepare stmt6 from 'select 1; select2';
--error 1064
prepare stmt6 from 'insert into t1 values (5,"five"); select2';
# This shouldn't parse
--error 1064
explain prepare stmt6 from 'insert into t1 values (5,"five"); select2';
create table t2
(
a int
);
insert into t2 values (0);
# parameter is NULL
set @arg00=NULL ;
prepare stmt1 from 'select 1 FROM t2 where a=?' ;
execute stmt1 using @arg00 ;
# prepare using variables:
--error 1064
prepare stmt1 from @nosuchvar;
set @ivar= 1234;
--error 1064
prepare stmt1 from @ivar;
set @fvar= 123.4567;
--error 1064
prepare stmt1 from @fvar;
set @str1 = 'select ?';
set @str2 = convert(@str1 using ucs2);
prepare stmt1 from @str2;
execute stmt1 using @ivar;
drop table t1,t2;

View file

@ -0,0 +1,153 @@
# Replication of character sets.
# This test will fail if the server/client does not support enough charsets.
# Remember that there currently exists
# Bug #2326: Charset of table is determined by charset of db only if "USE db;"
source include/master-slave.inc;
--disable_warnings
drop database if exists test2;
drop database if exists test3;
--enable_warnings
create database test2 character set latin2;
set @@character_set_server=latin5;
create database test3;
--disable_query_log
select "--- --master--" as "";
--enable_query_log
show create database test2;
show create database test3;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
show create database test2;
show create database test3;
connection master;
set @@collation_server=armscii_bin;
drop database test3;
create database test3;
--disable_query_log
select "--- --master--" as "";
--enable_query_log
show create database test3;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
show create database test3;
connection master;
use test2;
create table t1 (a int auto_increment primary key, b varchar(100));
set character_set_client=cp850, collation_connection=latin2_croatian_ci;
insert into t1 (b) values(@@character_set_server);
insert into t1 (b) values(@@collation_server);
# character_set_database and collation_database are not tested as they
# are not replicated (Bar said that this variable may be removed shortly).
insert into t1 (b) values(@@character_set_client);
# collation_client does not exist
insert into t1 (b) values(@@character_set_connection);
insert into t1 (b) values(@@collation_connection);
--disable_query_log
select "--- --master--" as "";
--enable_query_log
select * from t1 order by a;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
select * from test2.t1 order by a;
connection master;
set character_set_client=latin1, collation_connection=latin1_german1_ci;
truncate table t1;
insert into t1 (b) values(@@collation_connection);
insert into t1 (b) values(LEAST("Müller","Muffler"));
set collation_connection=latin1_german2_ci;
insert into t1 (b) values(@@collation_connection);
insert into t1 (b) values(LEAST("Müller","Muffler"));
--disable_query_log
select "--- --master--" as "";
--enable_query_log
select * from t1 order by a;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
select * from test2.t1 order by a;
# See if SET ONE_SHOT gets into binlog when LOAD DATA
connection master;
load data infile '../../std_data/words.dat' into table t1 (b);
# See if user var is prefixed with collation in binlog and replicated well.
# Note: replication of user variables is broken as far as derivation is
# concerned. That's because when we store a user variable in the binlog,
# we lose its derivation. So later on the slave, it's impossible to
# know if the collation was explicit or not, so we use DERIVATION_NONE,
# which provokes error messages (like 'Illegal mix of collation') when
# we replay the master's INSERT/etc statements.
set @a= _cp850 'Müller' collate cp850_general_ci;
truncate table t1;
insert into t1 (b) values(collation(@a));
--disable_query_log
select "--- --master--" as "";
--enable_query_log
select * from t1 order by a;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
select * from test2.t1 order by a;
connection master;
drop database test2;
drop database test3;
show binlog events from 79;
sync_slave_with_master;
# Check that we can't change global.collation_server
error 1105;
set global character_set_server=latin2;
connection master;
error 1105;
set global character_set_server=latin2;
# Check that SET ONE_SHOT is really one shot
set one_shot @@character_set_server=latin5;
set @@max_join_size=1000;
select @@character_set_server;
select @@character_set_server;
set @@character_set_server=latin5;
select @@character_set_server;
select @@character_set_server;
# ONE_SHOT on not charset/collation stuff is not allowed
error 1105;
set one_shot max_join_size=10;
# Test of wrong character set numbers;
error 1115;
set character_set_client=9999999;
error 1273;
set collation_server=9999998;
# This one was contributed by Sergey Petrunia (BUG#3943)
use test;
CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
SET CHARACTER_SET_CLIENT=koi8r,
CHARACTER_SET_CONNECTION=cp1251,
CHARACTER_SET_RESULTS=koi8r;
INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ');
select hex(c1), hex(c2) from t1;
sync_slave_with_master;
select hex(c1), hex(c2) from t1;
connection master;
drop table t1;
sync_slave_with_master;

View file

@ -0,0 +1,40 @@
source include/master-slave.inc;
connection slave;
create database test1;
connection master;
drop database if exists test1;
sync_slave_with_master;
# can't read dir
error 12;
show tables from test1;
connection slave;
create table t1 (a int);
connection master;
drop table if exists t1;
sync_slave_with_master;
# table does not exist
error 1146;
select * from t1;
connection master;
create table t1 (a int);
sync_slave_with_master;
insert into t1 values(1);
connection master;
delete from t1;
sync_slave_with_master;
select * from t1;
insert into t1 values(1);
connection master;
insert into t1 values(2);
update t1 set a=2;
sync_slave_with_master;
select * from t1;
# cleanup
connection master;
drop table t1;
sync_slave_with_master;

43
mysql-test/t/rpl_ps.test Normal file
View file

@ -0,0 +1,43 @@
#
# Test of replicating user variables
#
source include/master-slave.inc;
#save_master_pos;
#connection slave;
#sync_with_master;
#reset master;
#connection master;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1(n char(30));
prepare stmt1 from 'insert into t1 values (?)';
set @var1= "from-master-1";
execute stmt1 using @var1;
set @var1= "from-master-2-'',";
execute stmt1 using @var1;
select * from t1;
set @var2= 'insert into t1 values (concat("from-var-", ?))';
prepare stmt2 from @var2;
set @var1='from-master-3';
execute stmt2 using @var1;
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
connection master;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;
stop slave;

View file

@ -1,5 +1,8 @@
# This test checks that a slave does not execute queries originating
# from itself, by default.
# This test checks that the slave I/O thread refuses to start if slave
# and master have the same server id (because this is a useless setup,
# and otherwise SHOW SLAVE STATUS shows progress but all queries are
# ignored, which has caught our customers), unless
# --replicate-same-server-id.
source include/master-slave.inc;
connection slave;
@ -18,5 +21,4 @@ insert into t1 values (1);
# (when slave is its own master without --replicate-same-server-id)
sleep 2; # enough time for the event to be replicated (it should not)
show status like "slave_running";
select * from t1;
drop table t1;

View file

@ -137,3 +137,22 @@ WHERE ( r = 1 AND a IN ( 1, 2 ) AND ( u = 'w' OR u LIKE 'w/%' ) )
OR ( r = 1 AND a IN ( 1, 2, 3 ) AND ( u = 'w' ) );
drop table t1;
#
# Bug #3738: we have a ref key
#
CREATE TABLE t1 (a VARCHAR(16), UNIQUE(a));
INSERT INTO t1 VALUES ('1'), ('2'), ('3');
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = '2' LIMIT 0, 1;
SELECT FOUND_ROWS();
DROP TABLE t1;
#
# Bug #3845: group by, having and empty result
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (0), (0), (1), (2);
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = 0 GROUP BY a HAVING a > 10;
SELECT FOUND_ROWS();
DROP TABLE t1;

View file

@ -99,3 +99,24 @@ select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST';
select charset(@a),collation(@a),coercibility(@a);
--error 1267
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
# Check that user variables are binlogged correctly (BUG#3875)
create table t1 (a varchar(50));
reset master;
SET TIMESTAMP=10000;
SET @`a b`='hello';
INSERT INTO t1 VALUES(@`a b`);
set @var1= "';aaa";
insert into t1 values (@var1);
create table t2 (c char(30)) charset=ucs2;
set @v=convert('abc' using ucs2);
insert into t2 values (@v);
show binlog events from 79;
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
# absolutely need variables names to be quoted and strings to be
# escaped).
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
drop table t1, t2;

View file

@ -91,7 +91,7 @@ Tue Mar 26 15:09:45 1991 Mikael WIDENIUS (monty at panther)
Sat Mar 23 10:49:49 1991 Michael Widenius (monty at LYNX)
* Added init of alarm variables to skipp some warnings from gcc.
* Added init of alarm variables to skip some warnings from gcc.
Tue Mar 5 16:50:34 1991 Michael Widenius (monty at LYNX)
@ -124,7 +124,7 @@ Mon Aug 27 22:20:38 1990 Michael Widenius (monty at lynx)
Sun Apr 1 23:29:47 1990 Monty (monty at monty)
* Changed mf_keydisk.c to have separate functions for read and write.
Read can now return pointer to intern key-buffer to skipp
Read can now return pointer to intern key-buffer to skip
unessessary memcpy-s.
Fri Mar 23 23:03:39 1990 Monty (monty at monty)

View file

@ -21,6 +21,344 @@
#include <my_dir.h>
#include <my_xml.h>
/*
Collation language is implemented according to
subset of ICU Collation Customization (tailorings):
http://oss.software.ibm.com/icu/userguide/Collate_Customization.html
Collation language elements:
Delimiters:
space - skipped
<char> := A-Z | a-z | \uXXXX
Shift command:
<shift> := & - reset at this letter.
Diff command:
<d1> := < - Identifies a primary difference.
<d2> := << - Identifies a secondary difference.
<d3> := <<< - Idenfifies a tertiary difference.
Collation rules:
<ruleset> := <rule> { <ruleset> }
<rule> := <d1> <string>
| <d2> <string>
| <d3> <string>
| <shift> <char>
<string> := <char> [ <string> ]
An example, Polish collation:
&A < \u0105 <<< \u0104
&C < \u0107 <<< \u0106
&E < \u0119 <<< \u0118
&L < \u0142 <<< \u0141
&N < \u0144 <<< \u0143
&O < \u00F3 <<< \u00D3
&S < \u015B <<< \u015A
&Z < \u017A <<< \u017B
*/
typedef enum my_coll_lexem_num_en
{
MY_COLL_LEXEM_EOF = 0,
MY_COLL_LEXEM_DIFF = 1,
MY_COLL_LEXEM_SHIFT = 4,
MY_COLL_LEXEM_CHAR = 5,
MY_COLL_LEXEM_ERROR = 6
} my_coll_lexem_num;
typedef struct my_coll_lexem_st
{
const char *beg;
const char *end;
const char *prev;
int diff;
int code;
} MY_COLL_LEXEM;
/*
Initialize collation rule lexical anilizer
SYNOPSIS
my_coll_lexem_init
lexem Lex analizer to init
str Const string to parse
strend End of the string
USAGE
RETURN VALUES
N/A
*/
static void my_coll_lexem_init(MY_COLL_LEXEM *lexem,
const char *str, const char *strend)
{
lexem->beg= str;
lexem->prev= str;
lexem->end= strend;
lexem->diff= 0;
lexem->code= 0;
}
/*
Print collation customization expression parse error, with context.
SYNOPSIS
my_coll_lexem_print_error
lexem Lex analizer to take context from
errstr sting to write error to
errsize errstr size
txt error message
USAGE
RETURN VALUES
N/A
*/
static void my_coll_lexem_print_error(MY_COLL_LEXEM *lexem,
char *errstr, size_t errsize,
const char *txt)
{
char tail[30];
size_t len= lexem->end - lexem->prev;
strmake (tail, lexem->prev, min(len, sizeof(tail)-1));
errstr[errsize-1]= '\0';
my_snprintf(errstr,errsize-1,"%s at '%s'", txt, tail);
}
/*
Convert a hex digit into its numeric value
SYNOPSIS
ch2x
ch hex digit to convert
USAGE
RETURN VALUES
an integer value in the range 0..15
-1 on error
*/
static int ch2x(int ch)
{
if (ch >= '0' && ch <= '9')
return ch - '0';
if (ch >= 'a' && ch <= 'f')
return 10 + ch - 'a';
if (ch >= 'A' && ch <= 'F')
return 10 + ch - 'A';
return -1;
}
/*
Collation language lexical parser:
Scans the next lexem.
SYNOPSIS
my_coll_lexem_next
lexem Lex analizer, previously initialized by
my_coll_lexem_init.
USAGE
Call this function in a loop
RETURN VALUES
Lexem number: eof, diff, shift, char or error.
*/
static my_coll_lexem_num my_coll_lexem_next(MY_COLL_LEXEM *lexem)
{
for ( ;lexem->beg < lexem->end ; lexem->beg++)
{
lexem->prev= lexem->beg;
if (lexem->beg[0] == ' ' || lexem->beg[0] == '\t' ||
lexem->beg[0] == '\r' || lexem->beg[0] == '\n')
continue;
if (lexem->beg[0] == '&')
{
lexem->beg++;
return MY_COLL_LEXEM_SHIFT;
}
if (lexem->beg[0] == '<')
{
for (lexem->beg++, lexem->diff=1;
(lexem->beg < lexem->end) &&
(lexem->beg[0] == '<') && (lexem->diff<3);
lexem->beg++, lexem->diff++);
return MY_COLL_LEXEM_DIFF;
}
if ((lexem->beg[0] >= 'a' && lexem->beg[0] <= 'z') ||
(lexem->beg[0] >= 'A' && lexem->beg[0] <= 'Z'))
{
lexem->code= lexem->beg[0];
lexem->beg++;
return MY_COLL_LEXEM_CHAR;
}
if ((lexem->beg[0] == '\\') &&
(lexem->beg+2 < lexem->end) &&
(lexem->beg[1] == 'u'))
{
int ch;
lexem->code= 0;
for (lexem->beg+=2;
(lexem->beg < lexem->end) && ((ch= ch2x(lexem->beg[0])) >= 0) ;
lexem->beg++)
{
lexem->code= (lexem->code << 4) + ch;
}
return MY_COLL_LEXEM_CHAR;
}
return MY_COLL_LEXEM_ERROR;
}
return MY_COLL_LEXEM_EOF;
}
/*
Collation rule item
*/
typedef struct my_coll_rule_item_st
{
uint base; /* Base character */
uint curr; /* Current character */
int diff[3]; /* Primary, Secondary and Tertiary difference */
} MY_COLL_RULE;
/*
Collation language syntax parser.
Uses lexical parser.
SYNOPSIS
my_coll_rule_parse
rule Collation rule list to load to.
str A string containin collation language expression.
strend End of the string.
USAGE
RETURN VALUES
0 - OK
1 - ERROR, e.g. too many items.
*/
static int my_coll_rule_parse(MY_COLL_RULE *rule, size_t mitems,
const char *str, const char *strend,
char *errstr, size_t errsize)
{
MY_COLL_LEXEM lexem;
my_coll_lexem_num lexnum;
my_coll_lexem_num prevlexnum= MY_COLL_LEXEM_ERROR;
MY_COLL_RULE item;
int state= 0;
size_t nitems= 0;
/* Init all variables */
errstr[0]= '\0';
bzero(&item, sizeof(item));
my_coll_lexem_init(&lexem, str, strend);
while ((lexnum= my_coll_lexem_next(&lexem)))
{
if (lexnum == MY_COLL_LEXEM_ERROR)
{
my_coll_lexem_print_error(&lexem,errstr,errsize-1,"Unknown character");
return -1;
}
switch (state) {
case 0:
if (lexnum != MY_COLL_LEXEM_SHIFT)
{
my_coll_lexem_print_error(&lexem,errstr,errsize-1,"& expected");
return -1;
}
prevlexnum= lexnum;
state= 2;
continue;
case 1:
if (lexnum != MY_COLL_LEXEM_SHIFT && lexnum != MY_COLL_LEXEM_DIFF)
{
my_coll_lexem_print_error(&lexem,errstr,errsize-1,"& or < expected");
return -1;
}
prevlexnum= lexnum;
state= 2;
continue;
case 2:
if (lexnum != MY_COLL_LEXEM_CHAR)
{
my_coll_lexem_print_error(&lexem,errstr,errsize-1,"character expected");
return -1;
}
if (prevlexnum == MY_COLL_LEXEM_SHIFT)
{
item.base= lexem.code;
item.diff[0]= 0;
item.diff[1]= 0;
item.diff[2]= 0;
}
else if (prevlexnum == MY_COLL_LEXEM_DIFF)
{
item.curr= lexem.code;
if (lexem.diff == 3)
{
item.diff[2]++;
}
else if (lexem.diff == 2)
{
item.diff[1]++;
item.diff[2]= 0;
}
else if (lexem.diff == 1)
{
item.diff[0]++;
item.diff[1]= 0;
item.diff[2]= 0;
}
if (nitems >= mitems)
{
my_coll_lexem_print_error(&lexem,errstr,errsize-1,"Too many rules");
return -1;
}
rule[nitems++]= item;
}
else
{
my_coll_lexem_print_error(&lexem,errstr,errsize-1,"Should never happen");
return -1;
}
state= 1;
continue;
}
}
return (size_t) nitems;
}
typedef struct
{
int nchars;
@ -284,6 +622,273 @@ err:
}
#ifdef HAVE_CHARSET_ucs2
typedef struct my_tailoring_st
{
uint number;
const char *name;
const char *tailoring;
} my_tailoring;
static my_tailoring tailoring[]=
{
{
0, "icelandic",
/*
Some sources treat LETTER A WITH DIARESIS (00E4,00C4)
secondary greater than LETTER AE (00E6,00C6).
http://www.evertype.com/alphabets/icelandic.pdf
http://developer.mimer.com/collations/charts/icelandic.htm
Other sources do not provide any special rules
for LETTER A WITH DIARESIS:
http://www.omniglot.com/writing/icelandic.htm
http://en.wikipedia.org/wiki/Icelandic_alphabet
http://oss.software.ibm.com/icu/charts/collation/is.html
Let's go the first way.
*/
"& A < \\u00E1 <<< \\u00C1 "
"& D < \\u00F0 <<< \\u00D0 "
"& E < \\u00E9 <<< \\u00C9 "
"& I < \\u00ED <<< \\u00CD "
"& O < \\u00F3 <<< \\u00D3 "
"& U < \\u00FA <<< \\u00DA "
"& Y < \\u00FD <<< \\u00DD "
"& Z < \\u00FE <<< \\u00DE "
"< \\u00E6 <<< \\u00C6 << \\u00E4 <<< \\u00C4 "
"< \\u00F6 <<< \\u00D6 << \\u00F8 <<< \\u00D8 "
"< \\u00E5 <<< \\u00C5 "
},
{
1, "latvian",
/*
Some sources treat I and Y primary different.
Other sources treat I and Y the same on primary level.
We'll go the first way.
*/
"& C < \\u010D <<< \\u010C "
"& G < \\u0123 <<< \\u0122 "
"& I < \\u0079 <<< \\u0059 "
"& K < \\u0137 <<< \\u0136 "
"& L < \\u013C <<< \\u013B "
"& N < \\u0146 <<< \\u0145 "
"& R < \\u0157 <<< \\u0156 "
"& S < \\u0161 <<< \\u0160 "
"& Z < \\u017E <<< \\u017D "
},
{
2, "romanian",
"& A < \\u0103 <<< \\u0102 < \\u00E2 <<< \\u00C2 "
"& I < \\u00EE <<< \\u00CE "
"& S < \\u0219 <<< \\u0218 << \\u015F <<< \\u015E "
"& T < \\u021B <<< \\u021A << \\u0163 <<< \\u0162 "
},
{
3, "slovenian",
"& C < \\u010D <<< \\u010C "
"& S < \\u0161 <<< \\u0160 "
"& Z < \\u017E <<< \\u017D "
},
{
4, "polish",
"& A < \\u0105 <<< \\u0104 "
"& C < \\u0107 <<< \\u0106 "
"& E < \\u0119 <<< \\u0118 "
"& L < \\u0142 <<< \\u0141 "
"& N < \\u0144 <<< \\u0143 "
"& O < \\u00F3 <<< \\u00D3 "
"& S < \\u015B <<< \\u015A "
"& Z < \\u017A <<< \\u017B "
},
{
5, "estonian",
"& S < \\u0161 <<< \\u0160 "
" < \\u007A <<< \\u005A "
" < \\u017E <<< \\u017D "
"& W < \\u00F5 <<< \\u00D5 "
"< \\u00E4 <<< \\u00C4 "
"< \\u00F6 <<< \\u00D6 "
"< \\u00FC <<< \\u00DC "
},
{
6, "spanish",
"& N < \\u00F1 <<< \\u00D1 "
},
{
7, "swedish",
/*
Some sources treat V and W as similar on primary level.
We'll treat V and W as different on primary level.
*/
"& Y <<\\u00FC <<< \\u00DC "
"& Z < \\u00E5 <<< \\u00C5 "
"< \\u00E4 <<< \\u00C4 << \\u00E6 <<< \\u00C6 "
"< \\u00F6 <<< \\u00D6 << \\u00F8 <<< \\u00D8 "
},
{
8, "turkish",
"& C < \\u00E7 <<< \\u00C7 "
"& G < \\u011F <<< \\u011E "
"& H < \\u0131 <<< \\u0049 "
"& O < \\u00F6 <<< \\u00D6 "
"& S < \\u015F <<< \\u015E "
"& U < \\u00FC <<< \\u00DC "
},
{
0, NULL, NULL
}
};
#define MY_MAX_COLL_RULE 64
/*
This function copies an UCS2 collation from
the default Unicode Collation Algorithm (UCA)
weights applying tailorings, i.e. a set of
alternative weights for some characters.
The default UCA weights are stored in my_charset_ucs2_general_uca.
They consist of 256 pages, 256 character each.
If a page is not overwritten by tailoring rules,
it is copies as is from UCA as is.
If a page contains some overwritten characters, it is
allocated. Untouched characters are copied from the
default weights.
*/
static my_bool create_tailoring(CHARSET_INFO *cs)
{
MY_COLL_RULE rule[MY_MAX_COLL_RULE];
char errstr[128];
uchar *newlengths;
uint16 **newweights;
const uchar *deflengths= my_charset_ucs2_general_uca.sort_order;
uint16 **defweights= my_charset_ucs2_general_uca.sort_order_big;
int rc, i;
if (!cs->tailoring)
return 1;
/* Parse ICU Collation Customization expression */
if ((rc= my_coll_rule_parse(rule, MY_MAX_COLL_RULE,
cs->tailoring,
cs->tailoring + strlen(cs->tailoring),
errstr, sizeof(errstr))) <= 0)
{
/*
TODO: add error message reporting.
printf("Error: %d '%s'\n", rc, errstr);
*/
return 1;
}
if (!(newweights= (uint16**) my_once_alloc(256*sizeof(uint16*),MYF(MY_WME))))
return 1;
bzero(newweights, 256*sizeof(uint16*));
if (!(newlengths= (uchar*) my_once_memdup(deflengths,256,MYF(MY_WME))))
return 1;
/*
Calculate maximum lenghts for the pages
which will be overwritten.
*/
for (i=0; i < rc; i++)
{
uint pageb= (rule[i].base >> 8) & 0xFF;
uint pagec= (rule[i].curr >> 8) & 0xFF;
if (newlengths[pagec] < deflengths[pageb])
newlengths[pagec]= deflengths[pageb];
}
for (i=0; i < rc; i++)
{
uint pageb= (rule[i].base >> 8) & 0xFF;
uint pagec= (rule[i].curr >> 8) & 0xFF;
uint chb, chc;
if (!newweights[pagec])
{
/* Alloc new page and copy the default UCA weights */
uint size= 256*newlengths[pagec]*sizeof(uint16);
if (!(newweights[pagec]= (uint16*) my_once_alloc(size,MYF(MY_WME))))
return 1;
bzero((void*) newweights[pagec], size);
for (chc=0 ; chc < 256; chc++)
{
memcpy(newweights[pagec] + chc*newlengths[pagec],
defweights[pagec] + chc*deflengths[pagec],
deflengths[pagec]*sizeof(uint16));
}
}
/*
Aply the alternative rule:
shift to the base character and primary difference.
*/
chc= rule[i].curr & 0xFF;
chb= rule[i].base & 0xFF;
memcpy(newweights[pagec] + chc*newlengths[pagec],
defweights[pageb] + chb*deflengths[pageb],
deflengths[pageb]*sizeof(uint16));
/* Apply primary difference */
newweights[pagec][chc*newlengths[pagec]]+= rule[i].diff[0];
}
/* Copy non-overwritten pages from the default UCA weights */
for (i= 0; i < 256 ; i++)
if (!newweights[i])
newweights[i]= defweights[i];
cs->sort_order= newlengths;
cs->sort_order_big= newweights;
return 0;
}
static int ucs2_copy_data(CHARSET_INFO *to, CHARSET_INFO *from)
{
to->number= from->number ? from->number : to->number;
if (from->csname)
if (!(to->csname= my_once_strdup(from->csname,MYF(MY_WME))))
goto err;
if (from->name)
if (!(to->name= my_once_strdup(from->name,MYF(MY_WME))))
goto err;
if (from->comment)
if (!(to->comment= my_once_strdup(from->comment,MYF(MY_WME))))
goto err;
if (from->tailoring)
if (!(to->tailoring= my_once_strdup(from->tailoring,MYF(MY_WME))))
goto err;
to->strxfrm_multiply= my_charset_ucs2_general_uca.strxfrm_multiply;
to->min_sort_char= my_charset_ucs2_general_uca.min_sort_char;
to->max_sort_char= my_charset_ucs2_general_uca.max_sort_char;
to->mbminlen= 2;
to->mbmaxlen= 2;
return create_tailoring(to);
err:
return 1;
}
#endif
static my_bool simple_cs_is_full(CHARSET_INFO *cs)
{
return ((cs->csname && cs->tab_to_uni && cs->ctype && cs->to_upper &&
@ -315,14 +920,28 @@ static int add_collation(CHARSET_INFO *cs)
if (!(all_charsets[cs->number]->state & MY_CS_COMPILED))
{
simple_cs_init_functions(all_charsets[cs->number]);
if (simple_cs_copy_data(all_charsets[cs->number],cs))
return MY_XML_ERROR;
if (simple_cs_is_full(all_charsets[cs->number]))
if (!strcmp(cs->csname,"ucs2") )
{
all_charsets[cs->number]->state |= MY_CS_LOADED;
#ifdef HAVE_CHARSET_ucs2
CHARSET_INFO *new= all_charsets[cs->number];
new->cset= my_charset_ucs2_general_uca.cset;
new->coll= my_charset_ucs2_general_uca.coll;
if (ucs2_copy_data(new, cs))
return MY_XML_ERROR;
new->state |= MY_CS_AVAILABLE | MY_CS_LOADED;
#endif
}
else
{
simple_cs_init_functions(all_charsets[cs->number]);
if (simple_cs_copy_data(all_charsets[cs->number],cs))
return MY_XML_ERROR;
if (simple_cs_is_full(all_charsets[cs->number]))
{
all_charsets[cs->number]->state |= MY_CS_LOADED;
}
all_charsets[cs->number]->state|= MY_CS_AVAILABLE;
}
all_charsets[cs->number]->state|= MY_CS_AVAILABLE;
}
else
{
@ -358,6 +977,25 @@ static int add_collation(CHARSET_INFO *cs)
return MY_XML_OK;
}
#ifdef HAVE_CHARSET_ucs2
static my_bool init_uca_charsets()
{
my_tailoring *t;
CHARSET_INFO cs= my_charset_ucs2_general_uca;
char name[64];
cs.state= MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONTEXT;
for (t= tailoring; t->tailoring; t++)
{
cs.number= 128 + t->number;
cs.tailoring= t->tailoring;
cs.name= name;
sprintf(name, "ucs2_%s_ci", t->name);
add_collation(&cs);
}
return 0;
}
#endif
#define MY_MAX_ALLOWED_BUF 1024*1024
#define MY_CHARSET_INDEX "Index.xml"
@ -457,6 +1095,9 @@ static my_bool init_available_charsets(myf myflags)
bzero(&all_charsets,sizeof(all_charsets));
init_compiled_charsets(myflags);
#ifdef HAVE_CHARSET_ucs2
init_uca_charsets();
#endif
/* Copy compiled charsets */
for (cs=all_charsets;

View file

@ -222,7 +222,7 @@ int load_defaults(const char *conf_file, const char **groups,
/* copy name + found arguments + command line arguments to new array */
res[0]= argv[0][0]; /* Name MUST be set, even by embedded library */
memcpy((gptr) (res+1), args.buffer, args.elements*sizeof(char*));
/* Skipp --defaults-file and --defaults-extra-file */
/* Skip --defaults-file and --defaults-extra-file */
(*argc)-= args_used;
(*argv)+= args_used;

View file

@ -800,7 +800,7 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
{ /* Fix if skipped bytes */
if (info->aio_read_pos + read_length < info->pos_in_file)
{
read_length=0; /* Skipp block */
read_length=0; /* Skip block */
next_pos_in_file=info->pos_in_file;
}
else
@ -894,7 +894,7 @@ int _my_b_async_read(register IO_CACHE *info, byte *Buffer, uint Count)
if (aioread(info->file,read_buffer,(int) max_length,
(my_off_t) next_pos_in_file,MY_SEEK_SET,
&info->aio_result.result))
{ /* Skipp async io */
{ /* Skip async io */
my_errno=errno;
DBUG_PRINT("error",("got error: %d, aio_result: %d from aioread, async skipped",
errno, info->aio_result.result.aio_errno));

View file

@ -266,7 +266,7 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
fmt++;
/* Found one '%' */
}
/* Skipp if max size is used (to be compatible with printf) */
/* Skip if max size is used (to be compatible with printf) */
while (my_isdigit(&my_charset_latin1, *fmt) || *fmt == '.' || *fmt == '-')
fmt++;
if (*fmt == 's') /* String parameter */

View file

@ -43,7 +43,7 @@ void pack_dirname(my_string to, const char *from)
(void) intern_filename(to,from); /* Change to intern name */
#ifdef FN_DEVCHAR
if ((start=strrchr(to,FN_DEVCHAR)) != 0) /* Skipp device part */
if ((start=strrchr(to,FN_DEVCHAR)) != 0) /* Skip device part */
start++;
else
#endif
@ -131,7 +131,7 @@ uint cleanup_dirname(register my_string to, const char *from)
from_ptr=(my_string) from;
#ifdef FN_DEVCHAR
if ((pos=strrchr(from_ptr,FN_DEVCHAR)) != 0)
{ /* Skipp device part */
{ /* Skip device part */
length=(uint) (pos-from_ptr)+1;
start=strnmov(buff,from_ptr,length); from_ptr+=length;
}
@ -195,7 +195,7 @@ uint cleanup_dirname(register my_string to, const char *from)
pos--; /* Remove dupplicate '/' */
}
else if (pos-start > 1 && pos[-1] == FN_CURLIB && pos[-2] == FN_LIBCHAR)
pos-=2; /* Skipp /./ */
pos-=2; /* Skip /./ */
else if (pos > buff+1 && pos[-1] == FN_HOMELIB && pos[-2] == FN_LIBCHAR)
{ /* Found ..../~/ */
buff[0]=FN_HOMELIB;
@ -409,7 +409,7 @@ uint system_filename(my_string to, const char *from)
libchar_found=0;
(void) strmov(buff,from); /* If to == from */
from_pos= buff;
if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skipp device part */
if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skip device part */
{
pos++;
to_pos=strnmov(to,from_pos,(size_s) (pos-from_pos));
@ -419,7 +419,7 @@ uint system_filename(my_string to, const char *from)
to_pos=to;
if (from_pos[0] == FN_CURLIB && from_pos[1] == FN_LIBCHAR)
from_pos+=2; /* Skipp './' */
from_pos+=2; /* Skip './' */
if (strchr(from_pos,FN_LIBCHAR))
{
*(to_pos++) = FN_C_BEFORE_DIR;
@ -487,7 +487,7 @@ my_string intern_filename(my_string to, const char *from)
convert_dirname(buff,from,NullS); /* change '<>' to '[]' */
from_pos=buff;
if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skipp device part */
if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skip device part */
{
pos++;
to_pos=strnmov(to,from_pos,(size_s) (pos-from_pos));

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