diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 8df4f7049c5..6df2fc31e25 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -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 diff --git a/VC++Files/client/mysqlclient.dsp b/VC++Files/client/mysqlclient.dsp index c680ba28116..88ae9352139 100644 --- a/VC++Files/client/mysqlclient.dsp +++ b/VC++Files/client/mysqlclient.dsp @@ -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 diff --git a/VC++Files/examples/udf_example/udf_example.def b/VC++Files/examples/udf_example/udf_example.def new file mode 100644 index 00000000000..c1cfeea63f8 --- /dev/null +++ b/VC++Files/examples/udf_example/udf_example.def @@ -0,0 +1,9 @@ +LIBRARY MYUDF +DESCRIPTION 'MySQL Sample for UDF' +VERSION 1.0 +EXPORTS + metaphon + myfunc_double + myfunc_int + sequence + avgcost \ No newline at end of file diff --git a/VC++Files/examples/udf_example/udf_example.dsp b/VC++Files/examples/udf_example/udf_example.dsp new file mode 100644 index 00000000000..bfe4d76bcc7 --- /dev/null +++ b/VC++Files/examples/udf_example/udf_example.dsp @@ -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 diff --git a/VC++Files/examples/udf_example/udf_example.dsw b/VC++Files/examples/udf_example/udf_example.dsw new file mode 100644 index 00000000000..6716e107f6a --- /dev/null +++ b/VC++Files/examples/udf_example/udf_example.dsw @@ -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> +{{{ +}}} + +############################################################################### + diff --git a/VC++Files/zlib/zlib.dsp b/VC++Files/zlib/zlib.dsp index 6edab34d93c..7093c51d558 100644 --- a/VC++Files/zlib/zlib.dsp +++ b/VC++Files/zlib/zlib.dsp @@ -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 diff --git a/acconfig.h b/acconfig.h index 54e0ff94e18..964e0018d86 100644 --- a/acconfig.h +++ b/acconfig.h @@ -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 diff --git a/acinclude.m4 b/acinclude.m4 index a7f8c92038d..baad145c0e0 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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.]) ]) diff --git a/client/mysqldump.c b/client/mysqldump.c index 2b40264325f..9c64e2d1b3a 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -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 */ diff --git a/client/mysqltest.c b/client/mysqltest.c index be2270850fa..830846eda84 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -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)); diff --git a/configure.in b/configure.in index 8c91a367679..be40d8ff029 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/extra/perror.c b/extra/perror.c index a31889cc26d..26ebdd5b096 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -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]); } } diff --git a/heap/hp_hash.c b/heap/hp_hash.c index 38ed581fe58..1f36f9b3059 100644 --- a/heap/hp_hash.c +++ b/heap/hp_hash.c @@ -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; diff --git a/include/m_ctype.h b/include/m_ctype.h index 9502805b017..87b45bd4954 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -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; diff --git a/include/my_global.h b/include/my_global.h index 57c736d6f75..3d1a770d877 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -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 */ diff --git a/include/myisampack.h b/include/myisampack.h index 95793e2aaeb..06c94fea75f 100644 --- a/include/myisampack.h +++ b/include/myisampack.h @@ -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); } diff --git a/include/mysql.h b/include/mysql.h index ad85bcc1bbd..71bff833d59 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -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); diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 84a655bcb77..aa5787ee30e 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -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); } diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c index 3b033655856..a200116797a 100644 --- a/innobase/fil/fil0fil.c +++ b/innobase/fil/fil0fil.c @@ -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 diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h index 930390241d3..6549a3748df 100644 --- a/innobase/include/os0file.h +++ b/innobase/include/os0file.h @@ -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 '.' diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h index af6d8969cfc..390e8c4da57 100644 --- a/innobase/include/row0mysql.h +++ b/innobase/include/row0mysql.h @@ -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 diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c index 223d9af78d1..58c88f67017 100644 --- a/innobase/lock/lock0lock.c +++ b/innobase/lock/lock0lock.c @@ -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(); } /************************************************************************* diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index caf09ed9f5f..469e7c025b6 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -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; } diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 623069cc90c..974dfa3e1c8 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -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; diff --git a/isam/_dynrec.c b/isam/_dynrec.c index d17d34e6778..25fe01e23f2 100644 --- a/isam/_dynrec.c +++ b/isam/_dynrec.c @@ -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); diff --git a/isam/isamchk.c b/isam/isamchk.c index cccd7cf4127..5dd20c14063 100644 --- a/isam/isamchk.c +++ b/isam/isamchk.c @@ -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; diff --git a/isam/isamlog.c b/isam/isamlog.c index 75a35ef9704..5cc204b26aa 100644 --- a/isam/isamlog.c +++ b/isam/isamlog.c @@ -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) diff --git a/isam/pack_isam.c b/isam/pack_isam.c index 9108070f918..aa83b2b2a96 100644 --- a/isam/pack_isam.c +++ b/isam/pack_isam.c @@ -28,7 +28,7 @@ #include #endif #ifndef __GNU_LIBRARY__ -#define __GNU_LIBRARY__ /* Skipp warnings in getopt.h */ +#define __GNU_LIBRARY__ /* Skip warnings in getopt.h */ #endif #include diff --git a/isam/test1.c b/isam/test1.c index 9ebc7af041d..b9f4d8242c3 100644 --- a/isam/test1.c +++ b/isam/test1.c @@ -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 */ diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 49b076d1b98..b77fc5fd6fd 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -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 */ diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def index 927d46be91c..bbd5af6558d 100644 --- a/libmysql/libmysql.def +++ b/libmysql/libmysql.def @@ -131,3 +131,4 @@ EXPORTS mysql_stmt_insert_id mysql_stmt_attr_get mysql_stmt_attr_set + mysql_stmt_field_count diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index e258b10c6e6..b165d7f457b 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -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)\"" diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def index 7c93951df7a..ac982f9110e 100644 --- a/libmysqld/libmysqld.def +++ b/libmysqld/libmysqld.def @@ -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 diff --git a/merge/mrg_open.c b/merge/mrg_open.c index 83b776ea201..6bf75392131 100644 --- a/merge/mrg_open.c +++ b/merge/mrg_open.c @@ -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)) diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 5f20046d1cf..6da0fd9552b 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -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 diff --git a/myisam/mi_delete.c b/myisam/mi_delete.c index 19cfc050ea1..3eb8e9a7226 100644 --- a/myisam/mi_delete.c +++ b/myisam/mi_delete.c @@ -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 */ { diff --git a/myisam/mi_key.c b/myisam/mi_key.c index d81584d648b..4aebba041f8 100644 --- a/myisam/mi_key.c +++ b/myisam/mi_key.c @@ -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; diff --git a/myisam/mi_open.c b/myisam/mi_open.c index 562227d2f03..d03c18091aa 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -20,6 +20,7 @@ #include "sp_defs.h" #include "rt_index.h" #include +#include #if defined(MSDOS) || defined(__WIN__) #ifdef __WIN__ diff --git a/myisam/mi_search.c b/myisam/mi_search.c index 1c4342ff39a..51ced6fa15a 100644 --- a/myisam/mi_search.c +++ b/myisam/mi_search.c @@ -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; diff --git a/myisam/mi_unique.c b/myisam/mi_unique.c index 38b4ed93311..4d82858c9ad 100644 --- a/myisam/mi_unique.c +++ b/myisam/mi_unique.c @@ -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) diff --git a/myisam/myisamlog.c b/myisam/myisamlog.c index 82f6277ce25..6679510227e 100644 --- a/myisam/myisamlog.c +++ b/myisam/myisamlog.c @@ -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) diff --git a/myisam/rt_index.c b/myisam/rt_index.c index 6a2606a1f8e..4fffd848624 100644 --- a/myisam/rt_index.c +++ b/myisam/rt_index.c @@ -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; diff --git a/myisam/rt_index.h b/myisam/rt_index.h index 1a24c403043..d3fcd934719 100644 --- a/myisam/rt_index.h +++ b/myisam/rt_index.h @@ -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); diff --git a/myisam/rt_key.c b/myisam/rt_key.c index e05bb744cc1..e2a402fbefd 100644 --- a/myisam/rt_key.c +++ b/myisam/rt_key.c @@ -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*/ diff --git a/myisam/rt_key.h b/myisam/rt_key.h index 92e10d04783..df4f8aa03a2 100644 --- a/myisam/rt_key.h +++ b/myisam/rt_key.h @@ -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 */ diff --git a/myisam/rt_mbr.c b/myisam/rt_mbr.c index c7864228e08..7b556979904 100644 --- a/myisam/rt_mbr.c +++ b/myisam/rt_mbr.c @@ -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; diff --git a/myisam/rt_mbr.h b/myisam/rt_mbr.h index 1367163da79..2153faad2b4 100644 --- a/myisam/rt_mbr.h +++ b/myisam/rt_mbr.h @@ -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*/ diff --git a/myisam/rt_split.c b/myisam/rt_split.c index ccc4c0733f4..005e86805bb 100644 --- a/myisam/rt_split.c +++ b/myisam/rt_split.c @@ -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; } diff --git a/myisam/rt_test.c b/myisam/rt_test.c index 5bf390cd0d8..5e883e223b3 100644 --- a/myisam/rt_test.c +++ b/myisam/rt_test.c @@ -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 "$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 diff --git a/mysql-test/ndb/stop_ndbcluster.sh b/mysql-test/ndb/stop_ndbcluster.sh deleted file mode 100755 index eb86b2b9c2d..00000000000 --- a/mysql-test/ndb/stop_ndbcluster.sh +++ /dev/null @@ -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 diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result new file mode 100644 index 00000000000..b380ea910de --- /dev/null +++ b/mysql-test/r/archive.result @@ -0,0 +1,1396 @@ +drop table if exists t1,t2; +CREATE TABLE t1 ( +Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, +Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL +) ENGINE=archive; +INSERT INTO t1 VALUES (9410,9412); +select period from t1; +period +9410 +select * from t1; +Period Varor_period +9410 9412 +select t1.* from t1; +Period Varor_period +9410 9412 +CREATE TABLE t2 ( +auto int, +fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL, +companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL, +fld3 char(30) DEFAULT '' NOT NULL, +fld4 char(35) DEFAULT '' NOT NULL, +fld5 char(35) DEFAULT '' NOT NULL, +fld6 char(4) DEFAULT '' NOT NULL +) ENGINE=archive; +select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%"; +fld3 +imaginable +select fld3 from t2 where fld3 like "%cultivation" ; +fld3 +cultivation +select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3; +fld3 companynr +concoct 58 +druggists 58 +engrossing 58 +Eurydice 58 +exclaimers 58 +ferociousness 58 +hopelessness 58 +Huey 58 +imaginable 58 +judges 58 +merging 58 +ostrich 58 +peering 58 +Phelps 58 +presumes 58 +Ruth 58 +sentences 58 +Shylock 58 +straggled 58 +synergy 58 +thanking 58 +tying 58 +unlocks 58 +select fld3,companynr from t2 where companynr = 58 order by fld3; +fld3 companynr +concoct 58 +druggists 58 +engrossing 58 +Eurydice 58 +exclaimers 58 +ferociousness 58 +hopelessness 58 +Huey 58 +imaginable 58 +judges 58 +merging 58 +ostrich 58 +peering 58 +Phelps 58 +presumes 58 +Ruth 58 +sentences 58 +Shylock 58 +straggled 58 +synergy 58 +thanking 58 +tying 58 +unlocks 58 +select fld3 from t2 order by fld3 desc limit 10; +fld3 +youthfulness +yelped +Wotan +workers +Witt +witchcraft +Winsett +Willy +willed +wildcats +select fld3 from t2 order by fld3 desc limit 5; +fld3 +youthfulness +yelped +Wotan +workers +Witt +select fld3 from t2 order by fld3 desc limit 5,5; +fld3 +witchcraft +Winsett +Willy +willed +wildcats +select t2.fld3 from t2 where fld3 = 'honeysuckle'; +fld3 +honeysuckle +select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_'; +fld3 +honeysuckle +select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_'; +fld3 +honeysuckle +select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%'; +fld3 +honeysuckle +select t2.fld3 from t2 where fld3 LIKE 'h%le'; +fld3 +honeysuckle +select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_'; +fld3 +select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%'; +fld3 +select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; +fld3 +honeysuckle +honoring +select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3; +fld1 fld3 +148504 Colombo +068305 Colombo +000000 nondecreasing +select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; +fld1 fld3 +012001 flanking +013602 foldout +013606 fingerings +018007 fanatic +018017 featherweight +018054 fetters +018103 flint +018104 flopping +036002 funereal +038017 fetched +038205 firearm +058004 Fenton +088303 feminine +186002 freakish +188007 flurried +188505 fitting +198006 furthermore +202301 Fitzpatrick +208101 fiftieth +208113 freest +218008 finishers +218022 feed +218401 faithful +226205 foothill +226209 furnishings +228306 forthcoming +228311 fated +231315 freezes +232102 forgivably +238007 filial +238008 fixedly +select fld3 from t2 where fld3 like "L%" and fld3 = "ok"; +fld3 +select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly"); +fld3 +Chantilly +select fld1,fld3 from t2 where fld1 like "25050%"; +fld1 fld3 +250501 poisoning +250502 Iraqis +250503 heaving +250504 population +250505 bomb +select fld1,fld3 from t2 where fld1 like "25050_"; +fld1 fld3 +250501 poisoning +250502 Iraqis +250503 heaving +250504 population +250505 bomb +INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat',''); +INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W'); +INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring',''); +INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily',''); +SELECT * FROM t2; +auto fld1 companynr fld3 fld4 fld5 fld6 +1 000001 00 Omaha teethe neat +2 011401 37 breaking dreaded Steinberg W +3 011402 37 Romans scholastics jarring +4 011403 37 intercepted audiology tinily +5 011501 37 bewilderingly wallet balled +6 011701 37 astound parters persist W +7 011702 37 admonishing eschew attainments +8 011703 37 sumac quitter fanatic +9 012001 37 flanking neat measures FAS +10 012003 37 combed Steinberg rightfulness +11 012004 37 subjective jarring capably +12 012005 37 scatterbrain tinily impulsive +13 012301 37 Eulerian balled starlet +14 012302 36 dubbed persist terminators +15 012303 37 Kane attainments untying +16 012304 37 overlay fanatic announces FAS +17 012305 37 perturb measures featherweight FAS +18 012306 37 goblins rightfulness pessimist FAS +19 012501 37 annihilates capably daughter +20 012602 37 Wotan impulsive decliner FAS +21 012603 37 snatching starlet lawgiver +22 012604 37 concludes terminators stated +23 012605 37 laterally untying readable +24 012606 37 yelped announces attrition +25 012701 37 grazing featherweight cascade FAS +26 012702 37 Baird pessimist motors FAS +27 012703 37 celery daughter interrogate +28 012704 37 misunderstander decliner pests W +29 013601 37 handgun lawgiver stairway +30 013602 37 foldout stated dopers FAS +31 013603 37 mystic readable testicle W +32 013604 37 succumbed attrition Parsifal W +33 013605 37 Nabisco cascade leavings +34 013606 37 fingerings motors postulation W +35 013607 37 aging interrogate squeaking +36 013608 37 afield pests contrasted +37 013609 37 ammonium stairway leftover +38 013610 37 boat dopers whiteners +39 013801 37 intelligibility testicle erases W +40 013802 37 Augustine Parsifal Punjab W +41 013803 37 teethe leavings Merritt +42 013804 37 dreaded postulation Quixotism +43 013901 37 scholastics squeaking sweetish FAS +44 016001 37 audiology contrasted dogging FAS +45 016201 37 wallet leftover scornfully FAS +46 016202 37 parters whiteners bellow +47 016301 37 eschew erases bills +48 016302 37 quitter Punjab cupboard FAS +49 016303 37 neat Merritt sureties FAS +50 016304 37 Steinberg Quixotism puddings +51 018001 37 jarring sweetish tapestry +52 018002 37 tinily dogging fetters +53 018003 37 balled scornfully bivalves +54 018004 37 persist bellow incurring +55 018005 37 attainments bills Adolph +56 018007 37 fanatic cupboard pithed +57 018008 37 measures sureties emergency +58 018009 37 rightfulness puddings Miles +59 018010 37 capably tapestry trimmings +60 018012 37 impulsive fetters tragedies W +61 018013 37 starlet bivalves skulking W +62 018014 37 terminators incurring flint +63 018015 37 untying Adolph flopping W +64 018016 37 announces pithed relaxing FAS +65 018017 37 featherweight emergency offload FAS +66 018018 37 pessimist Miles suites W +67 018019 37 daughter trimmings lists FAS +68 018020 37 decliner tragedies animized FAS +69 018021 37 lawgiver skulking multilayer W +70 018022 37 stated flint standardizes FAS +71 018023 37 readable flopping Judas +72 018024 37 attrition relaxing vacuuming W +73 018025 37 cascade offload dentally W +74 018026 37 motors suites humanness W +75 018027 37 interrogate lists inch W +76 018028 37 pests animized Weissmuller W +77 018029 37 stairway multilayer irresponsibly W +78 018030 37 dopers standardizes luckily FAS +79 018032 37 testicle Judas culled W +80 018033 37 Parsifal vacuuming medical FAS +81 018034 37 leavings dentally bloodbath FAS +82 018035 37 postulation humanness subschema W +83 018036 37 squeaking inch animals W +84 018037 37 contrasted Weissmuller Micronesia +85 018038 37 leftover irresponsibly repetitions +86 018039 37 whiteners luckily Antares +87 018040 37 erases culled ventilate W +88 018041 37 Punjab medical pityingly +89 018042 37 Merritt bloodbath interdependent +90 018043 37 Quixotism subschema Graves FAS +91 018044 37 sweetish animals neonatal +92 018045 37 dogging Micronesia scribbled FAS +93 018046 37 scornfully repetitions chafe W +94 018048 37 bellow Antares honoring +95 018049 37 bills ventilate realtor +96 018050 37 cupboard pityingly elite +97 018051 37 sureties interdependent funereal +98 018052 37 puddings Graves abrogating +99 018053 50 tapestry neonatal sorters +100 018054 37 fetters scribbled Conley +101 018055 37 bivalves chafe lectured +102 018056 37 incurring honoring Abraham +103 018057 37 Adolph realtor Hawaii W +104 018058 37 pithed elite cage +105 018059 36 emergency funereal hushes +106 018060 37 Miles abrogating Simla +107 018061 37 trimmings sorters reporters +108 018101 37 tragedies Conley Dutchman FAS +109 018102 37 skulking lectured descendants FAS +110 018103 37 flint Abraham groupings FAS +111 018104 37 flopping Hawaii dissociate +112 018201 37 relaxing cage coexist W +113 018202 37 offload hushes Beebe +114 018402 37 suites Simla Taoism +115 018403 37 lists reporters Connally +116 018404 37 animized Dutchman fetched FAS +117 018405 37 multilayer descendants checkpoints FAS +118 018406 37 standardizes groupings rusting +119 018409 37 Judas dissociate galling +120 018601 37 vacuuming coexist obliterates +121 018602 37 dentally Beebe traitor +122 018603 37 humanness Taoism resumes FAS +123 018801 37 inch Connally analyzable FAS +124 018802 37 Weissmuller fetched terminator FAS +125 018803 37 irresponsibly checkpoints gritty FAS +126 018804 37 luckily rusting firearm W +127 018805 37 culled galling minima +128 018806 37 medical obliterates Selfridge +129 018807 37 bloodbath traitor disable +130 018808 37 subschema resumes witchcraft W +131 018809 37 animals analyzable betroth W +132 018810 37 Micronesia terminator Manhattanize +133 018811 37 repetitions gritty imprint +134 018812 37 Antares firearm peeked +135 019101 37 ventilate minima swelling +136 019102 37 pityingly Selfridge interrelationships W +137 019103 37 interdependent disable riser +138 019201 37 Graves witchcraft Gandhian W +139 030501 37 neonatal betroth peacock A +140 030502 50 scribbled Manhattanize bee A +141 030503 37 chafe imprint kanji +142 030504 37 honoring peeked dental +143 031901 37 realtor swelling scarf FAS +144 036001 37 elite interrelationships chasm A +145 036002 37 funereal riser insolence A +146 036004 37 abrogating Gandhian syndicate +147 036005 37 sorters peacock alike +148 038001 37 Conley bee imperial A +149 038002 37 lectured kanji convulsion A +150 038003 37 Abraham dental railway A +151 038004 37 Hawaii scarf validate A +152 038005 37 cage chasm normalizes A +153 038006 37 hushes insolence comprehensive +154 038007 37 Simla syndicate chewing +155 038008 37 reporters alike denizen +156 038009 37 Dutchman imperial schemer +157 038010 37 descendants convulsion chronicle +158 038011 37 groupings railway Kline +159 038012 37 dissociate validate Anatole +160 038013 37 coexist normalizes partridges +161 038014 37 Beebe comprehensive brunch +162 038015 37 Taoism chewing recruited +163 038016 37 Connally denizen dimensions W +164 038017 37 fetched schemer Chicana W +165 038018 37 checkpoints chronicle announced +166 038101 37 rusting Kline praised FAS +167 038102 37 galling Anatole employing +168 038103 37 obliterates partridges linear +169 038104 37 traitor brunch quagmire +170 038201 37 resumes recruited western A +171 038202 37 analyzable dimensions relishing +172 038203 37 terminator Chicana serving A +173 038204 37 gritty announced scheduling +174 038205 37 firearm praised lore +175 038206 37 minima employing eventful +176 038208 37 Selfridge linear arteriole A +177 042801 37 disable quagmire disentangle +178 042802 37 witchcraft western cured A +179 046101 37 betroth relishing Fenton W +180 048001 37 Manhattanize serving avoidable A +181 048002 37 imprint scheduling drains A +182 048003 37 peeked lore detectably FAS +183 048004 37 swelling eventful husky +184 048005 37 interrelationships arteriole impelling +185 048006 37 riser disentangle undoes +186 048007 37 Gandhian cured evened +187 048008 37 peacock Fenton squeezes +188 048101 37 bee avoidable destroyer FAS +189 048102 37 kanji drains rudeness +190 048201 37 dental detectably beaner FAS +191 048202 37 scarf husky boorish +192 048203 37 chasm impelling Everhart +193 048204 37 insolence undoes encompass A +194 048205 37 syndicate evened mushrooms +195 048301 37 alike squeezes Alison A +196 048302 37 imperial destroyer externally FAS +197 048303 37 convulsion rudeness pellagra +198 048304 37 railway beaner cult +199 048305 37 validate boorish creek A +200 048401 37 normalizes Everhart Huffman +201 048402 37 comprehensive encompass Majorca FAS +202 048403 37 chewing mushrooms governing A +203 048404 37 denizen Alison gadfly FAS +204 048405 37 schemer externally reassigned FAS +205 048406 37 chronicle pellagra intentness W +206 048407 37 Kline cult craziness +207 048408 37 Anatole creek psychic +208 048409 37 partridges Huffman squabbled +209 048410 37 brunch Majorca burlesque +210 048411 37 recruited governing capped +211 048412 37 dimensions gadfly extracted A +212 048413 37 Chicana reassigned DiMaggio +213 048601 37 announced intentness exclamation FAS +214 048602 37 praised craziness subdirectory +215 048603 37 employing psychic fangs +216 048604 37 linear squabbled buyer A +217 048801 37 quagmire burlesque pithing A +218 050901 37 western capped transistorizing A +219 051201 37 relishing extracted nonbiodegradable +220 056002 37 serving DiMaggio dislocate +221 056003 37 scheduling exclamation monochromatic FAS +222 056004 37 lore subdirectory batting +223 056102 37 eventful fangs postcondition A +224 056203 37 arteriole buyer catalog FAS +225 056204 37 disentangle pithing Remus +226 058003 37 cured transistorizing devices A +227 058004 37 Fenton nonbiodegradable bike A +228 058005 37 avoidable dislocate qualify +229 058006 37 drains monochromatic detained +230 058007 37 detectably batting commended +231 058101 37 husky postcondition civilize +232 058102 37 impelling catalog Elmhurst +233 058103 37 undoes Remus anesthetizing +234 058105 37 evened devices deaf +235 058111 37 squeezes bike Brigham +236 058112 37 destroyer qualify title +237 058113 37 rudeness detained coarse +238 058114 37 beaner commended combinations +239 058115 37 boorish civilize grayness +240 058116 37 Everhart Elmhurst innumerable FAS +241 058117 37 encompass anesthetizing Caroline A +242 058118 37 mushrooms deaf fatty FAS +243 058119 37 Alison Brigham eastbound +244 058120 37 externally title inexperienced +245 058121 37 pellagra coarse hoarder A +246 058122 37 cult combinations scotch W +247 058123 37 creek grayness passport A +248 058124 37 Huffman innumerable strategic FAS +249 058125 37 Majorca Caroline gated +250 058126 37 governing fatty flog +251 058127 37 gadfly eastbound Pipestone +252 058128 37 reassigned inexperienced Dar +253 058201 37 intentness hoarder Corcoran +254 058202 37 craziness scotch flyers A +255 058303 37 psychic passport competitions W +256 058304 37 squabbled strategic suppliers FAS +257 058602 37 burlesque gated skips +258 058603 37 capped flog institutes +259 058604 37 extracted Pipestone troop A +260 058605 37 DiMaggio Dar connective W +261 058606 37 exclamation Corcoran denies +262 058607 37 subdirectory flyers polka +263 060401 36 fangs competitions observations FAS +264 061701 36 buyer suppliers askers +265 066201 36 pithing skips homeless FAS +266 066501 36 transistorizing institutes Anna +267 068001 36 nonbiodegradable troop subdirectories W +268 068002 36 dislocate connective decaying FAS +269 068005 36 monochromatic denies outwitting W +270 068006 36 batting polka Harpy W +271 068007 36 postcondition observations crazed +272 068008 36 catalog askers suffocate +273 068009 36 Remus homeless provers FAS +274 068010 36 devices Anna technically +275 068011 36 bike subdirectories Franklinizations +276 068202 36 qualify decaying considered +277 068302 36 detained outwitting tinnily +278 068303 36 commended Harpy uninterruptedly +279 068401 36 civilize crazed whistled A +280 068501 36 Elmhurst suffocate automate +281 068502 36 anesthetizing provers gutting W +282 068503 36 deaf technically surreptitious +283 068602 36 Brigham Franklinizations Choctaw +284 068603 36 title considered cooks +285 068701 36 coarse tinnily millivolt FAS +286 068702 36 combinations uninterruptedly counterpoise +287 068703 36 grayness whistled Gothicism +288 076001 36 innumerable automate feminine +289 076002 36 Caroline gutting metaphysically W +290 076101 36 fatty surreptitious sanding A +291 076102 36 eastbound Choctaw contributorily +292 076103 36 inexperienced cooks receivers FAS +293 076302 36 hoarder millivolt adjourn +294 076303 36 scotch counterpoise straggled A +295 076304 36 passport Gothicism druggists +296 076305 36 strategic feminine thanking FAS +297 076306 36 gated metaphysically ostrich +298 076307 36 flog sanding hopelessness FAS +299 076402 36 Pipestone contributorily Eurydice +300 076501 36 Dar receivers excitation W +301 076502 36 Corcoran adjourn presumes FAS +302 076701 36 flyers straggled imaginable FAS +303 078001 36 competitions druggists concoct W +304 078002 36 suppliers thanking peering W +305 078003 36 skips ostrich Phelps FAS +306 078004 36 institutes hopelessness ferociousness FAS +307 078005 36 troop Eurydice sentences +308 078006 36 connective excitation unlocks +309 078007 36 denies presumes engrossing W +310 078008 36 polka imaginable Ruth +311 078101 36 observations concoct tying +312 078103 36 askers peering exclaimers +313 078104 36 homeless Phelps synergy +314 078105 36 Anna ferociousness Huey W +315 082101 36 subdirectories sentences merging +316 083401 36 decaying unlocks judges A +317 084001 36 outwitting engrossing Shylock W +318 084002 36 Harpy Ruth Miltonism +319 086001 36 crazed tying hen W +320 086102 36 suffocate exclaimers honeybee FAS +321 086201 36 provers synergy towers +322 088001 36 technically Huey dilutes W +323 088002 36 Franklinizations merging numerals FAS +324 088003 36 considered judges democracy FAS +325 088004 36 tinnily Shylock Ibero- +326 088101 36 uninterruptedly Miltonism invalids +327 088102 36 whistled hen behavior +328 088103 36 automate honeybee accruing +329 088104 36 gutting towers relics A +330 088105 36 surreptitious dilutes rackets +331 088106 36 Choctaw numerals Fischbein W +332 088201 36 cooks democracy phony W +333 088203 36 millivolt Ibero- cross FAS +334 088204 36 counterpoise invalids cleanup +335 088302 37 Gothicism behavior conspirator +336 088303 37 feminine accruing label FAS +337 088305 37 metaphysically relics university +338 088402 37 sanding rackets cleansed FAS +339 088501 36 contributorily Fischbein ballgown +340 088502 36 receivers phony starlet +341 088503 36 adjourn cross aqueous +342 098001 58 straggled cleanup portrayal A +343 098002 58 druggists conspirator despising W +344 098003 58 thanking label distort W +345 098004 58 ostrich university palmed +346 098005 58 hopelessness cleansed faced +347 098006 58 Eurydice ballgown silverware +348 141903 29 excitation starlet assessor +349 098008 58 presumes aqueous spiders +350 098009 58 imaginable portrayal artificially +351 098010 58 concoct despising reminiscence +352 098011 58 peering distort Mexican +353 098012 58 Phelps palmed obnoxious +354 098013 58 ferociousness faced fragile +355 098014 58 sentences silverware apprehensible +356 098015 58 unlocks assessor births +357 098016 58 engrossing spiders garages +358 098017 58 Ruth artificially panty +359 098018 58 tying reminiscence anteater +360 098019 58 exclaimers Mexican displacement A +361 098020 58 synergy obnoxious drovers A +362 098021 58 Huey fragile patenting A +363 098022 58 merging apprehensible far A +364 098023 58 judges births shrieks +365 098024 58 Shylock garages aligning W +366 098025 37 Miltonism panty pragmatism +367 106001 36 hen anteater fevers W +368 108001 36 honeybee displacement reexamines A +369 108002 36 towers drovers occupancies +370 108003 36 dilutes patenting sweats FAS +371 108004 36 numerals far modulators +372 108005 36 democracy shrieks demand W +373 108007 36 Ibero- aligning Madeira +374 108008 36 invalids pragmatism Viennese W +375 108009 36 behavior fevers chillier W +376 108010 36 accruing reexamines wildcats FAS +377 108011 36 relics occupancies gentle +378 108012 36 rackets sweats Angles W +379 108101 36 Fischbein modulators accuracies +380 108102 36 phony demand toggle +381 108103 36 cross Madeira Mendelssohn W +382 108111 50 cleanup Viennese behaviorally +383 108105 36 conspirator chillier Rochford +384 108106 36 label wildcats mirror W +385 108107 36 university gentle Modula +386 108108 50 cleansed Angles clobbering +387 108109 36 ballgown accuracies chronography +388 108110 36 starlet toggle Eskimoizeds +389 108201 36 aqueous Mendelssohn British W +390 108202 36 portrayal behaviorally pitfalls +391 108203 36 despising Rochford verify W +392 108204 36 distort mirror scatter FAS +393 108205 36 palmed Modula Aztecan +394 108301 36 faced clobbering acuity W +395 108302 36 silverware chronography sinking W +396 112101 36 assessor Eskimoizeds beasts FAS +397 112102 36 spiders British Witt W +398 113701 36 artificially pitfalls physicists FAS +399 116001 36 reminiscence verify folksong A +400 116201 36 Mexican scatter strokes FAS +401 116301 36 obnoxious Aztecan crowder +402 116302 36 fragile acuity merry +403 116601 36 apprehensible sinking cadenced +404 116602 36 births beasts alimony A +405 116603 36 garages Witt principled A +406 116701 36 panty physicists golfing +407 116702 36 anteater folksong undiscovered +408 118001 36 displacement strokes irritates +409 118002 36 drovers crowder patriots A +410 118003 36 patenting merry rooms FAS +411 118004 36 far cadenced towering W +412 118005 36 shrieks alimony displease +413 118006 36 aligning principled photosensitive +414 118007 36 pragmatism golfing inking +415 118008 36 fevers undiscovered gainers +416 118101 36 reexamines irritates leaning A +417 118102 36 occupancies patriots hydrant A +418 118103 36 sweats rooms preserve +419 118202 36 modulators towering blinded A +420 118203 36 demand displease interactions A +421 118204 36 Madeira photosensitive Barry +422 118302 36 Viennese inking whiteness A +423 118304 36 chillier gainers pastimes W +424 118305 36 wildcats leaning Edenization +425 118306 36 gentle hydrant Muscat +426 118307 36 Angles preserve assassinated +427 123101 36 accuracies blinded labeled +428 123102 36 toggle interactions glacial A +429 123301 36 Mendelssohn Barry implied W +430 126001 36 behaviorally whiteness bibliographies W +431 126002 36 Rochford pastimes Buchanan +432 126003 36 mirror Edenization forgivably FAS +433 126101 36 Modula Muscat innuendo A +434 126301 36 clobbering assassinated den FAS +435 126302 36 chronography labeled submarines W +436 126402 36 Eskimoizeds glacial mouthful A +437 126601 36 British implied expiring +438 126602 36 pitfalls bibliographies unfulfilled FAS +439 126702 36 verify Buchanan precession +440 128001 36 scatter forgivably nullified +441 128002 36 Aztecan innuendo affects +442 128003 36 acuity den Cynthia +443 128004 36 sinking submarines Chablis A +444 128005 36 beasts mouthful betterments FAS +445 128007 36 Witt expiring advertising +446 128008 36 physicists unfulfilled rubies A +447 128009 36 folksong precession southwest FAS +448 128010 36 strokes nullified superstitious A +449 128011 36 crowder affects tabernacle W +450 128012 36 merry Cynthia silk A +451 128013 36 cadenced Chablis handsomest A +452 128014 36 alimony betterments Persian A +453 128015 36 principled advertising analog W +454 128016 36 golfing rubies complex W +455 128017 36 undiscovered southwest Taoist +456 128018 36 irritates superstitious suspend +457 128019 36 patriots tabernacle relegated +458 128020 36 rooms silk awesome W +459 128021 36 towering handsomest Bruxelles +460 128022 36 displease Persian imprecisely A +461 128023 36 photosensitive analog televise +462 128101 36 inking complex braking +463 128102 36 gainers Taoist true FAS +464 128103 36 leaning suspend disappointing FAS +465 128104 36 hydrant relegated navally W +466 128106 36 preserve awesome circus +467 128107 36 blinded Bruxelles beetles +468 128108 36 interactions imprecisely trumps +469 128202 36 Barry televise fourscore W +470 128203 36 whiteness braking Blackfoots +471 128301 36 pastimes true Grady +472 128302 36 Edenization disappointing quiets FAS +473 128303 36 Muscat navally floundered FAS +474 128304 36 assassinated circus profundity W +475 128305 36 labeled beetles Garrisonian W +476 128307 36 glacial trumps Strauss +477 128401 36 implied fourscore cemented FAS +478 128502 36 bibliographies Blackfoots contrition A +479 128503 36 Buchanan Grady mutations +480 128504 36 forgivably quiets exhibits W +481 128505 36 innuendo floundered tits +482 128601 36 den profundity mate A +483 128603 36 submarines Garrisonian arches +484 128604 36 mouthful Strauss Moll +485 128702 36 expiring cemented ropers +486 128703 36 unfulfilled contrition bombast +487 128704 36 precession mutations difficultly A +488 138001 36 nullified exhibits adsorption +489 138002 36 affects tits definiteness FAS +490 138003 36 Cynthia mate cultivation A +491 138004 36 Chablis arches heals A +492 138005 36 betterments Moll Heusen W +493 138006 36 advertising ropers target FAS +494 138007 36 rubies bombast cited A +495 138008 36 southwest difficultly congresswoman W +496 138009 36 superstitious adsorption Katherine +497 138102 36 tabernacle definiteness titter A +498 138103 36 silk cultivation aspire A +499 138104 36 handsomest heals Mardis +500 138105 36 Persian Heusen Nadia W +501 138201 36 analog target estimating FAS +502 138302 36 complex cited stuck A +503 138303 36 Taoist congresswoman fifteenth A +504 138304 36 suspend Katherine Colombo +505 138401 29 relegated titter survey A +506 140102 29 awesome aspire staffing +507 140103 29 Bruxelles Mardis obtain +508 140104 29 imprecisely Nadia loaded +509 140105 29 televise estimating slaughtered +510 140201 29 braking stuck lights A +511 140701 29 true fifteenth circumference +512 141501 29 disappointing Colombo dull A +513 141502 29 navally survey weekly A +514 141901 29 circus staffing wetness +515 141902 29 beetles obtain visualized +516 142101 29 trumps loaded Tannenbaum +517 142102 29 fourscore slaughtered moribund +518 142103 29 Blackfoots lights demultiplex +519 142701 29 Grady circumference lockings +520 143001 29 quiets dull thugs FAS +521 143501 29 floundered weekly unnerves +522 143502 29 profundity wetness abut +523 148001 29 Garrisonian visualized Chippewa A +524 148002 29 Strauss Tannenbaum stratifications A +525 148003 29 cemented moribund signaled +526 148004 29 contrition demultiplex Italianizes A +527 148005 29 mutations lockings algorithmic A +528 148006 29 exhibits thugs paranoid FAS +529 148007 29 tits unnerves camping A +530 148009 29 mate abut signifying A +531 148010 29 arches Chippewa Patrice W +532 148011 29 Moll stratifications search A +533 148012 29 ropers signaled Angeles A +534 148013 29 bombast Italianizes semblance +535 148023 36 difficultly algorithmic taxed +536 148015 29 adsorption paranoid Beatrice +537 148016 29 definiteness camping retrace +538 148017 29 cultivation signifying lockout +539 148018 29 heals Patrice grammatic +540 148019 29 Heusen search helmsman +541 148020 29 target Angeles uniform W +542 148021 29 cited semblance hamming +543 148022 29 congresswoman taxed disobedience +544 148101 29 Katherine Beatrice captivated A +545 148102 29 titter retrace transferals A +546 148201 29 aspire lockout cartographer A +547 148401 29 Mardis grammatic aims FAS +548 148402 29 Nadia helmsman Pakistani +549 148501 29 estimating uniform burglarized FAS +550 148502 29 stuck hamming saucepans A +551 148503 29 fifteenth disobedience lacerating A +552 148504 29 Colombo captivated corny +553 148601 29 survey transferals megabytes FAS +554 148602 29 staffing cartographer chancellor +555 150701 29 obtain aims bulk A +556 152101 29 loaded Pakistani commits A +557 152102 29 slaughtered burglarized meson W +558 155202 36 lights saucepans deputies +559 155203 29 circumference lacerating northeaster A +560 155204 29 dull corny dipole +561 155205 29 weekly megabytes machining 0 +562 156001 29 wetness chancellor therefore +563 156002 29 visualized bulk Telefunken +564 156102 29 Tannenbaum commits salvaging +565 156301 29 moribund meson Corinthianizes A +566 156302 29 demultiplex deputies restlessly A +567 156303 29 lockings northeaster bromides +568 156304 29 thugs dipole generalized A +569 156305 29 unnerves machining mishaps +570 156306 29 abut therefore quelling +571 156501 29 Chippewa Telefunken spiritual A +572 158001 29 stratifications salvaging beguiles FAS +573 158002 29 signaled Corinthianizes Trobriand FAS +574 158101 29 Italianizes restlessly fleeing A +575 158102 29 algorithmic bromides Armour A +576 158103 29 paranoid generalized chin A +577 158201 29 camping mishaps provers A +578 158202 29 signifying quelling aeronautic A +579 158203 29 Patrice spiritual voltage W +580 158204 29 search beguiles sash +581 158301 29 Angeles Trobriand anaerobic A +582 158302 29 semblance fleeing simultaneous A +583 158303 29 taxed Armour accumulating A +584 158304 29 Beatrice chin Medusan A +585 158305 29 retrace provers shouted A +586 158306 29 lockout aeronautic freakish +587 158501 29 grammatic voltage index FAS +588 160301 29 helmsman sash commercially +589 166101 50 uniform anaerobic mistiness A +590 166102 50 hamming simultaneous endpoint +591 168001 29 disobedience accumulating straight A +592 168002 29 captivated Medusan flurried +593 168003 29 transferals shouted denotative A +594 168101 29 cartographer freakish coming FAS +595 168102 29 aims index commencements FAS +596 168103 29 Pakistani commercially gentleman +597 168104 29 burglarized mistiness gifted +598 168202 29 saucepans endpoint Shanghais +599 168301 29 lacerating straight sportswriting A +600 168502 29 corny flurried sloping A +601 168503 29 megabytes denotative navies +602 168601 29 chancellor coming leaflet A +603 173001 40 bulk commencements shooter +604 173701 40 commits gentleman Joplin FAS +605 173702 40 meson gifted babies +606 176001 40 deputies Shanghais subdivision FAS +607 176101 40 northeaster sportswriting burstiness W +608 176201 40 dipole sloping belted FAS +609 176401 40 machining navies assails FAS +610 176501 40 therefore leaflet admiring W +611 176601 40 Telefunken shooter swaying 0 +612 176602 40 salvaging Joplin Goldstine FAS +613 176603 40 Corinthianizes babies fitting +614 178001 40 restlessly subdivision Norwalk W +615 178002 40 bromides burstiness weakening W +616 178003 40 generalized belted analogy FAS +617 178004 40 mishaps assails deludes +618 178005 40 quelling admiring cokes +619 178006 40 spiritual swaying Clayton +620 178007 40 beguiles Goldstine exhausts +621 178008 40 Trobriand fitting causality +622 178101 40 fleeing Norwalk sating FAS +623 178102 40 Armour weakening icon +624 178103 40 chin analogy throttles +625 178201 40 provers deludes communicants FAS +626 178202 40 aeronautic cokes dehydrate FAS +627 178301 40 voltage Clayton priceless FAS +628 178302 40 sash exhausts publicly +629 178401 40 anaerobic causality incidentals FAS +630 178402 40 simultaneous sating commonplace +631 178403 40 accumulating icon mumbles +632 178404 40 Medusan throttles furthermore W +633 178501 40 shouted communicants cautioned W +634 186002 37 freakish dehydrate parametrized A +635 186102 37 index priceless registration A +636 186201 40 commercially publicly sadly FAS +637 186202 40 mistiness incidentals positioning +638 186203 40 endpoint commonplace babysitting +639 186302 37 straight mumbles eternal A +640 188007 37 flurried furthermore hoarder +641 188008 37 denotative cautioned congregates +642 188009 37 coming parametrized rains +643 188010 37 commencements registration workers W +644 188011 37 gentleman sadly sags A +645 188012 37 gifted positioning unplug W +646 188013 37 Shanghais babysitting garage A +647 188014 37 sportswriting eternal boulder A +648 188015 37 sloping hoarder hollowly A +649 188016 37 navies congregates specifics +650 188017 37 leaflet rains Teresa +651 188102 37 shooter workers Winsett +652 188103 37 Joplin sags convenient A +653 188202 37 babies unplug buckboards FAS +654 188301 40 subdivision garage amenities +655 188302 40 burstiness boulder resplendent FAS +656 188303 40 belted hollowly priding FAS +657 188401 37 assails specifics configurations +658 188402 37 admiring Teresa untidiness A +659 188503 37 swaying Winsett Brice W +660 188504 37 Goldstine convenient sews FAS +661 188505 37 fitting buckboards participated +662 190701 37 Norwalk amenities Simon FAS +663 190703 50 weakening resplendent certificates +664 191701 37 analogy priding Fitzpatrick +665 191702 37 deludes configurations Evanston A +666 191703 37 cokes untidiness misted +667 196001 37 Clayton Brice textures A +668 196002 37 exhausts sews save +669 196003 37 causality participated count +670 196101 37 sating Simon rightful A +671 196103 37 icon certificates chaperone +672 196104 37 throttles Fitzpatrick Lizzy A +673 196201 37 communicants Evanston clenched A +674 196202 37 dehydrate misted effortlessly +675 196203 37 priceless textures accessed +676 198001 37 publicly save beaters A +677 198003 37 incidentals count Hornblower FAS +678 198004 37 commonplace rightful vests A +679 198005 37 mumbles chaperone indulgences FAS +680 198006 37 furthermore Lizzy infallibly A +681 198007 37 cautioned clenched unwilling FAS +682 198008 37 parametrized effortlessly excrete FAS +683 198009 37 registration accessed spools A +684 198010 37 sadly beaters crunches FAS +685 198011 37 positioning Hornblower overestimating FAS +686 198012 37 babysitting vests ineffective +687 198013 37 eternal indulgences humiliation A +688 198014 37 hoarder infallibly sophomore +689 198015 37 congregates unwilling star +690 198017 37 rains excrete rifles +691 198018 37 workers spools dialysis +692 198019 37 sags crunches arriving +693 198020 37 unplug overestimating indulge +694 198021 37 garage ineffective clockers +695 198022 37 boulder humiliation languages +696 198023 50 hollowly sophomore Antarctica A +697 198024 37 specifics star percentage +698 198101 37 Teresa rifles ceiling A +699 198103 37 Winsett dialysis specification +700 198105 37 convenient arriving regimented A +701 198106 37 buckboards indulge ciphers +702 198201 37 amenities clockers pictures A +703 198204 37 resplendent languages serpents A +704 198301 53 priding Antarctica allot A +705 198302 53 configurations percentage realized A +706 198303 53 untidiness ceiling mayoral A +707 198304 53 Brice specification opaquely A +708 198401 37 sews regimented hostess FAS +709 198402 37 participated ciphers fiftieth +710 198403 37 Simon pictures incorrectly +711 202101 37 certificates serpents decomposition FAS +712 202301 37 Fitzpatrick allot stranglings +713 202302 37 Evanston realized mixture FAS +714 202303 37 misted mayoral electroencephalography FAS +715 202304 37 textures opaquely similarities FAS +716 202305 37 save hostess charges W +717 202601 37 count fiftieth freest FAS +718 202602 37 rightful incorrectly Greenberg FAS +719 202605 37 chaperone decomposition tinting +720 202606 37 Lizzy stranglings expelled W +721 202607 37 clenched mixture warm +722 202901 37 effortlessly electroencephalography smoothed +723 202902 37 accessed similarities deductions FAS +724 202903 37 beaters charges Romano W +725 202904 37 Hornblower freest bitterroot +726 202907 37 vests Greenberg corset +727 202908 37 indulgences tinting securing +728 203101 37 infallibly expelled environing FAS +729 203103 37 unwilling warm cute +730 203104 37 excrete smoothed Crays +731 203105 37 spools deductions heiress FAS +732 203401 37 crunches Romano inform FAS +733 203402 37 overestimating bitterroot avenge +734 203404 37 ineffective corset universals +735 203901 37 humiliation securing Kinsey W +736 203902 37 sophomore environing ravines FAS +737 203903 37 star cute bestseller +738 203906 37 rifles Crays equilibrium +739 203907 37 dialysis heiress extents 0 +740 203908 37 arriving inform relatively +741 203909 37 indulge avenge pressure FAS +742 206101 37 clockers universals critiques FAS +743 206201 37 languages Kinsey befouled +744 206202 37 Antarctica ravines rightfully FAS +745 206203 37 percentage bestseller mechanizing FAS +746 206206 37 ceiling equilibrium Latinizes +747 206207 37 specification extents timesharing +748 206208 37 regimented relatively Aden +749 208001 37 ciphers pressure embassies +750 208002 37 pictures critiques males FAS +751 208003 37 serpents befouled shapelessly FAS +752 208004 37 allot rightfully genres FAS +753 208008 37 realized mechanizing mastering +754 208009 37 mayoral Latinizes Newtonian +755 208010 37 opaquely timesharing finishers FAS +756 208011 37 hostess Aden abates +757 208101 37 fiftieth embassies teem +758 208102 37 incorrectly males kiting FAS +759 208103 37 decomposition shapelessly stodgy FAS +760 208104 37 stranglings genres scalps FAS +761 208105 37 mixture mastering feed FAS +762 208110 37 electroencephalography Newtonian guitars +763 208111 37 similarities finishers airships +764 208112 37 charges abates store +765 208113 37 freest teem denounces +766 208201 37 Greenberg kiting Pyle FAS +767 208203 37 tinting stodgy Saxony +768 208301 37 expelled scalps serializations FAS +769 208302 37 warm feed Peruvian FAS +770 208305 37 smoothed guitars taxonomically FAS +771 208401 37 deductions airships kingdom A +772 208402 37 Romano store stint A +773 208403 37 bitterroot denounces Sault A +774 208404 37 corset Pyle faithful +775 208501 37 securing Saxony Ganymede FAS +776 208502 37 environing serializations tidiness FAS +777 208503 37 cute Peruvian gainful FAS +778 208504 37 Crays taxonomically contrary FAS +779 208505 37 heiress kingdom Tipperary FAS +780 210101 37 inform stint tropics W +781 210102 37 avenge Sault theorizers +782 210103 37 universals faithful renew 0 +783 210104 37 Kinsey Ganymede already +784 210105 37 ravines tidiness terminal +785 210106 37 bestseller gainful Hegelian +786 210107 37 equilibrium contrary hypothesizer +787 210401 37 extents Tipperary warningly FAS +788 213201 37 relatively tropics journalizing FAS +789 213203 37 pressure theorizers nested +790 213204 37 critiques renew Lars +791 213205 37 befouled already saplings +792 213206 37 rightfully terminal foothill +793 213207 37 mechanizing Hegelian labeled +794 216101 37 Latinizes hypothesizer imperiously FAS +795 216103 37 timesharing warningly reporters FAS +796 218001 37 Aden journalizing furnishings FAS +797 218002 37 embassies nested precipitable FAS +798 218003 37 males Lars discounts FAS +799 218004 37 shapelessly saplings excises FAS +800 143503 50 genres foothill Stalin +801 218006 37 mastering labeled despot FAS +802 218007 37 Newtonian imperiously ripeness FAS +803 218008 37 finishers reporters Arabia +804 218009 37 abates furnishings unruly +805 218010 37 teem precipitable mournfulness +806 218011 37 kiting discounts boom FAS +807 218020 37 stodgy excises slaughter A +808 218021 50 scalps Stalin Sabine +809 218022 37 feed despot handy FAS +810 218023 37 guitars ripeness rural +811 218024 37 airships Arabia organizer +812 218101 37 store unruly shipyard FAS +813 218102 37 denounces mournfulness civics FAS +814 218103 37 Pyle boom inaccuracy FAS +815 218201 37 Saxony slaughter rules FAS +816 218202 37 serializations Sabine juveniles FAS +817 218203 37 Peruvian handy comprised W +818 218204 37 taxonomically rural investigations +819 218205 37 kingdom organizer stabilizes A +820 218301 37 stint shipyard seminaries FAS +821 218302 37 Sault civics Hunter A +822 218401 37 faithful inaccuracy sporty FAS +823 218402 37 Ganymede rules test FAS +824 218403 37 tidiness juveniles weasels +825 218404 37 gainful comprised CERN +826 218407 37 contrary investigations tempering +827 218408 37 Tipperary stabilizes afore FAS +828 218409 37 tropics seminaries Galatean +829 218410 37 theorizers Hunter techniques W +830 226001 37 renew sporty error +831 226002 37 already test veranda +832 226003 37 terminal weasels severely +833 226004 37 Hegelian CERN Cassites FAS +834 226005 37 hypothesizer tempering forthcoming +835 226006 37 warningly afore guides +836 226007 37 journalizing Galatean vanish FAS +837 226008 37 nested techniques lied A +838 226203 37 Lars error sawtooth FAS +839 226204 37 saplings veranda fated FAS +840 226205 37 foothill severely gradually +841 226206 37 labeled Cassites widens +842 226207 37 imperiously forthcoming preclude +843 226208 37 reporters guides Jobrel +844 226209 37 furnishings vanish hooker +845 226210 37 precipitable lied rainstorm +846 226211 37 discounts sawtooth disconnects +847 228001 37 excises fated cruelty +848 228004 37 Stalin gradually exponentials A +849 228005 37 despot widens affective A +850 228006 37 ripeness preclude arteries +851 228007 37 Arabia Jobrel Crosby FAS +852 228008 37 unruly hooker acquaint +853 228009 37 mournfulness rainstorm evenhandedly +854 228101 37 boom disconnects percentage +855 228108 37 slaughter cruelty disobedience +856 228109 37 Sabine exponentials humility +857 228110 37 handy affective gleaning A +858 228111 37 rural arteries petted A +859 228112 37 organizer Crosby bloater A +860 228113 37 shipyard acquaint minion A +861 228114 37 civics evenhandedly marginal A +862 228115 37 inaccuracy percentage apiary A +863 228116 37 rules disobedience measures +864 228117 37 juveniles humility precaution +865 228118 37 comprised gleaning repelled +866 228119 37 investigations petted primary FAS +867 228120 37 stabilizes bloater coverings +868 228121 37 seminaries minion Artemia A +869 228122 37 Hunter marginal navigate +870 228201 37 sporty apiary spatial +871 228206 37 test measures Gurkha +872 228207 37 weasels precaution meanwhile A +873 228208 37 CERN repelled Melinda A +874 228209 37 tempering primary Butterfield +875 228210 37 afore coverings Aldrich A +876 228211 37 Galatean Artemia previewing A +877 228212 37 techniques navigate glut A +878 228213 37 error spatial unaffected +879 228214 37 veranda Gurkha inmate +880 228301 37 severely meanwhile mineral +881 228305 37 Cassites Melinda impending A +882 228306 37 forthcoming Butterfield meditation A +883 228307 37 guides Aldrich ideas +884 228308 37 vanish previewing miniaturizes W +885 228309 37 lied glut lewdly +886 228310 37 sawtooth unaffected title +887 228311 37 fated inmate youthfulness +888 228312 37 gradually mineral creak FAS +889 228313 37 widens impending Chippewa +890 228314 37 preclude meditation clamored +891 228401 65 Jobrel ideas freezes +892 228402 65 hooker miniaturizes forgivably FAS +893 228403 65 rainstorm lewdly reduce FAS +894 228404 65 disconnects title McGovern W +895 228405 65 cruelty youthfulness Nazis W +896 228406 65 exponentials creak epistle W +897 228407 65 affective Chippewa socializes W +898 228408 65 arteries clamored conceptions +899 228409 65 Crosby freezes Kevin +900 228410 65 acquaint forgivably uncovering +901 230301 37 evenhandedly reduce chews FAS +902 230302 37 percentage McGovern appendixes FAS +903 230303 37 disobedience Nazis raining +904 018062 37 humility epistle infest +905 230501 37 gleaning socializes compartment +906 230502 37 petted conceptions minting +907 230503 37 bloater Kevin ducks +908 230504 37 minion uncovering roped A +909 230505 37 marginal chews waltz +910 230506 37 apiary appendixes Lillian +911 230507 37 measures raining repressions A +912 230508 37 precaution infest chillingly +913 230509 37 repelled compartment noncritical +914 230901 37 primary minting lithograph +915 230902 37 coverings ducks spongers +916 230903 37 Artemia roped parenthood +917 230904 37 navigate waltz posed +918 230905 37 spatial Lillian instruments +919 230906 37 Gurkha repressions filial +920 230907 37 meanwhile chillingly fixedly +921 230908 37 Melinda noncritical relives +922 230909 37 Butterfield lithograph Pandora +923 230910 37 Aldrich spongers watering A +924 230911 37 previewing parenthood ungrateful +925 230912 37 glut posed secures +926 230913 37 unaffected instruments chastisers +927 230914 37 inmate filial icon +928 231304 37 mineral fixedly reuniting A +929 231305 37 impending relives imagining A +930 231306 37 meditation Pandora abiding A +931 231307 37 ideas watering omnisciently +932 231308 37 miniaturizes ungrateful Britannic +933 231309 37 lewdly secures scholastics A +934 231310 37 title chastisers mechanics A +935 231311 37 youthfulness icon humidly A +936 231312 37 creak reuniting masterpiece +937 231313 37 Chippewa imagining however +938 231314 37 clamored abiding Mendelian +939 231315 37 freezes omnisciently jarred +940 232102 37 forgivably Britannic scolds +941 232103 37 reduce scholastics infatuate +942 232104 37 McGovern mechanics willed A +943 232105 37 Nazis humidly joyfully +944 232106 37 epistle masterpiece Microsoft +945 232107 37 socializes however fibrosities +946 232108 37 conceptions Mendelian Baltimorean +947 232601 37 Kevin jarred equestrian +948 232602 37 uncovering scolds Goodrich +949 232603 37 chews infatuate apish A +950 232605 37 appendixes willed Adlerian +5950 1232605 37 appendixes willed Adlerian +5951 1232606 37 appendixes willed Adlerian +5952 1232607 37 appendixes willed Adlerian +5953 1232608 37 appendixes willed Adlerian +5954 1232609 37 appendixes willed Adlerian +951 232606 37 raining joyfully Tropez +952 232607 37 infest Microsoft nouns +953 232608 37 compartment fibrosities distracting +954 232609 37 minting Baltimorean mutton +955 236104 37 ducks equestrian bridgeable A +956 236105 37 roped Goodrich stickers A +957 236106 37 waltz apish transcontinental A +958 236107 37 Lillian Adlerian amateurish +959 236108 37 repressions Tropez Gandhian +960 236109 37 chillingly nouns stratified +961 236110 37 noncritical distracting chamberlains +962 236111 37 lithograph mutton creditably +963 236112 37 spongers bridgeable philosophic +964 236113 37 parenthood stickers ores +965 238005 37 posed transcontinental Carleton +966 238006 37 instruments amateurish tape A +967 238007 37 filial Gandhian afloat A +968 238008 37 fixedly stratified goodness A +969 238009 37 relives chamberlains welcoming +970 238010 37 Pandora creditably Pinsky FAS +971 238011 37 watering philosophic halting +972 238012 37 ungrateful ores bibliography +973 238013 37 secures Carleton decoding +974 240401 41 chastisers tape variance A +975 240402 41 icon afloat allowed A +976 240901 41 reuniting goodness dire A +977 240902 41 imagining welcoming dub A +978 241801 41 abiding Pinsky poisoning +979 242101 41 omnisciently halting Iraqis A +980 242102 41 Britannic bibliography heaving +981 242201 41 scholastics decoding population A +982 242202 41 mechanics variance bomb A +983 242501 41 humidly allowed Majorca A +984 242502 41 masterpiece dire Gershwins +985 246201 41 however dub explorers +986 246202 41 Mendelian poisoning libretto A +987 246203 41 jarred Iraqis occurred +988 246204 41 scolds heaving Lagos +989 246205 41 infatuate population rats +990 246301 41 willed bomb bankruptcies A +991 246302 41 joyfully Majorca crying +992 248001 41 Microsoft Gershwins unexpected +993 248002 41 fibrosities explorers accessed A +994 248003 41 Baltimorean libretto colorful A +995 248004 41 equestrian occurred versatility A +996 248005 41 Goodrich Lagos cosy +997 248006 41 apish rats Darius A +998 248007 41 Adlerian bankruptcies mastering A +999 248008 41 Tropez crying Asiaticizations A +1000 248009 41 nouns unexpected offerers A +1001 248010 41 distracting accessed uncles A +1002 248011 41 mutton colorful sleepwalk +1003 248012 41 bridgeable versatility Ernestine +1004 248013 41 stickers cosy checksumming +1005 248014 41 transcontinental Darius stopped +1006 248015 41 amateurish mastering sicker +1007 248016 41 Gandhian Asiaticizations Italianization +1008 248017 41 stratified offerers alphabetic +1009 248018 41 chamberlains uncles pharmaceutic +1010 248019 41 creditably sleepwalk creator +1011 248020 41 philosophic Ernestine chess +1012 248021 41 ores checksumming charcoal +1013 248101 41 Carleton stopped Epiphany A +1014 248102 41 tape sicker bulldozes A +1015 248201 41 afloat Italianization Pygmalion A +1016 248202 41 goodness alphabetic caressing A +1017 248203 41 welcoming pharmaceutic Palestine A +1018 248204 41 Pinsky creator regimented A +1019 248205 41 halting chess scars A +1020 248206 41 bibliography charcoal realest A +1021 248207 41 decoding Epiphany diffusing A +1022 248208 41 variance bulldozes clubroom A +1023 248209 41 allowed Pygmalion Blythe A +1024 248210 41 dire caressing ahead +1025 248211 50 dub Palestine reviver +1026 250501 34 poisoning regimented retransmitting A +1027 250502 34 Iraqis scars landslide +1028 250503 34 heaving realest Eiffel +1029 250504 34 population diffusing absentee +1030 250505 34 bomb clubroom aye +1031 250601 34 Majorca Blythe forked A +1032 250602 34 Gershwins ahead Peruvianizes +1033 250603 34 explorers reviver clerked +1034 250604 34 libretto retransmitting tutor +1035 250605 34 occurred landslide boulevard +1036 251001 34 Lagos Eiffel shuttered +1037 251002 34 rats absentee quotes A +1038 251003 34 bankruptcies aye Caltech +1039 251004 34 crying forked Mossberg +1040 251005 34 unexpected Peruvianizes kept +1041 251301 34 accessed clerked roundly +1042 251302 34 colorful tutor features A +1043 251303 34 versatility boulevard imaginable A +1044 251304 34 cosy shuttered controller +1045 251305 34 Darius quotes racial +1046 251401 34 mastering Caltech uprisings A +1047 251402 34 Asiaticizations Mossberg narrowed A +1048 251403 34 offerers kept cannot A +1049 251404 34 uncles roundly vest +1050 251405 34 sleepwalk features famine +1051 251406 34 Ernestine imaginable sugars +1052 251801 34 checksumming controller exterminated A +1053 251802 34 stopped racial belays +1054 252101 34 sicker uprisings Hodges A +1055 252102 34 Italianization narrowed translatable +1056 252301 34 alphabetic cannot duality A +1057 252302 34 pharmaceutic vest recording A +1058 252303 34 creator famine rouses A +1059 252304 34 chess sugars poison +1060 252305 34 charcoal exterminated attitude +1061 252306 34 Epiphany belays dusted +1062 252307 34 bulldozes Hodges encompasses +1063 252308 34 Pygmalion translatable presentation +1064 252309 34 caressing duality Kantian +1065 256001 34 Palestine recording imprecision A +1066 256002 34 regimented rouses saving +1067 256003 34 scars poison maternal +1068 256004 34 realest attitude hewed +1069 256005 34 diffusing dusted kerosene +1070 258001 34 clubroom encompasses Cubans +1071 258002 34 Blythe presentation photographers +1072 258003 34 ahead Kantian nymph A +1073 258004 34 reviver imprecision bedlam A +1074 258005 34 retransmitting saving north A +1075 258006 34 landslide maternal Schoenberg A +1076 258007 34 Eiffel hewed botany A +1077 258008 34 absentee kerosene curs +1078 258009 34 aye Cubans solidification +1079 258010 34 forked photographers inheritresses +1080 258011 34 Peruvianizes nymph stiller +1081 258101 68 clerked bedlam t1 A +1082 258102 68 tutor north suite A +1083 258103 34 boulevard Schoenberg ransomer +1084 258104 68 shuttered botany Willy +1085 258105 68 quotes curs Rena A +1086 258106 68 Caltech solidification Seattle A +1087 258107 68 Mossberg inheritresses relaxes A +1088 258108 68 kept stiller exclaim +1089 258109 68 roundly t1 implicated A +1090 258110 68 features suite distinguish +1091 258111 68 imaginable ransomer assayed +1092 258112 68 controller Willy homeowner +1093 258113 68 racial Rena and +1094 258201 34 uprisings Seattle stealth +1095 258202 34 narrowed relaxes coinciding A +1096 258203 34 cannot exclaim founder A +1097 258204 34 vest implicated environing +1098 258205 34 famine distinguish jewelry +1099 258301 34 sugars assayed lemons A +1100 258401 34 exterminated homeowner brokenness A +1101 258402 34 belays and bedpost A +1102 258403 34 Hodges stealth assurers A +1103 258404 34 translatable coinciding annoyers +1104 258405 34 duality founder affixed +1105 258406 34 recording environing warbling +1106 258407 34 rouses jewelry seriously +1107 228123 37 poison lemons boasted +1108 250606 34 attitude brokenness Chantilly +1109 208405 37 dusted bedpost Iranizes +1110 212101 37 encompasses assurers violinist +1111 218206 37 presentation annoyers extramarital +1112 150401 37 Kantian affixed spates +1113 248212 41 imprecision warbling cloakroom +1114 128026 00 saving seriously gazer +1115 128024 00 maternal boasted hand +1116 128027 00 hewed Chantilly tucked +1117 128025 00 kerosene Iranizes gems +1118 128109 00 Cubans violinist clinker +1119 128705 00 photographers extramarital refiner +1120 126303 00 nymph spates callus +1121 128308 00 bedlam cloakroom leopards +1122 128204 00 north gazer comfortingly +1123 128205 00 Schoenberg hand generically +1124 128206 00 botany tucked getters +1125 128207 00 curs gems sexually +1126 118205 00 solidification clinker spear +1127 116801 00 inheritresses refiner serums +1128 116803 00 stiller callus Italianization +1129 116804 00 t1 leopards attendants +1130 116802 00 suite comfortingly spies +1131 128605 00 ransomer generically Anthony +1132 118308 00 Willy getters planar +1133 113702 00 Rena sexually cupped +1134 113703 00 Seattle spear cleanser +1135 112103 00 relaxes serums commuters +1136 118009 00 exclaim Italianization honeysuckle +5136 1118009 00 exclaim Italianization honeysuckle +1137 138011 00 implicated attendants orphanage +1138 138010 00 distinguish spies skies +1139 138012 00 assayed Anthony crushers +1140 068304 00 homeowner planar Puritan +1141 078009 00 and cupped squeezer +1142 108013 00 stealth cleanser bruises +1143 084004 00 coinciding commuters bonfire +1144 083402 00 founder honeysuckle Colombo +1145 084003 00 environing orphanage nondecreasing +1146 088504 00 jewelry skies innocents +1147 088005 00 lemons crushers masked +1148 088007 00 brokenness Puritan file +1149 088006 00 bedpost squeezer brush +1150 148025 00 assurers bruises mutilate +1151 148024 00 annoyers bonfire mommy +1152 138305 00 affixed Colombo bulkheads +1153 138306 00 warbling nondecreasing undeclared +1154 152701 00 seriously innocents displacements +1155 148505 00 boasted masked nieces +1156 158003 00 Chantilly file coeducation +1157 156201 00 Iranizes brush brassy +1158 156202 00 violinist mutilate authenticator +1159 158307 00 extramarital mommy Washoe +1160 158402 00 spates bulkheads penny +1161 158401 00 cloakroom undeclared Flagler +1162 068013 00 gazer displacements stoned +1163 068012 00 hand nieces cranes +1164 068203 00 tucked coeducation masterful +1165 088205 00 gems brassy biracial +1166 068704 00 clinker authenticator steamships +1167 068604 00 refiner Washoe windmills +1168 158502 00 callus penny exploit +1169 123103 00 leopards Flagler riverfront +1170 148026 00 comfortingly stoned sisterly +1171 123302 00 generically cranes sharpshoot +1172 076503 00 getters masterful mittens +1173 126304 00 sexually biracial interdependency +1174 068306 00 spear steamships policy +1175 143504 00 serums windmills unleashing +1176 160201 00 Italianization exploit pretenders +1177 148028 00 attendants riverfront overstatements +1178 148027 00 spies sisterly birthed +1179 143505 00 Anthony sharpshoot opportunism +1180 108014 00 planar mittens showroom +1181 076104 00 cupped interdependency compromisingly +1182 078106 00 cleanser policy Medicare +1183 126102 00 commuters unleashing corresponds +1184 128029 00 honeysuckle pretenders hardware +1185 128028 00 orphanage overstatements implant +1186 018410 00 skies birthed Alicia +1187 128110 00 crushers opportunism requesting +1188 148506 00 Puritan showroom produced +1189 123303 00 squeezer compromisingly criticizes +1190 123304 00 bruises Medicare backer +1191 068504 00 bonfire corresponds positively +1192 068305 00 Colombo hardware colicky +1193 000000 00 nondecreasing implant thrillingly +1 000001 00 Omaha teethe neat +2 011401 37 breaking dreaded Steinberg W +3 011402 37 Romans scholastics jarring +4 011403 37 intercepted audiology tinily +drop table t1, t2; diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 30795aaf106..f16524c020b 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -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)); diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result index cc062094535..7c3ae52cbc9 100644 --- a/mysql-test/r/ctype_ujis.result +++ b/mysql-test/r/ctype_ujis.result @@ -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; diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 28af71b7681..6c11dd210aa 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -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 diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 60a28e5018f..43bcf94d6d9 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -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 diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 569b4da0f85..f91691853b9 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -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); diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result index b66ef6d6a31..3fb1a5dd31c 100644 --- a/mysql-test/r/gis-rtree.result +++ b/mysql-test/r/gis-rtree.result @@ -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(*) diff --git a/mysql-test/r/have_archive.require b/mysql-test/r/have_archive.require new file mode 100644 index 00000000000..c4b4ba24fcd --- /dev/null +++ b/mysql-test/r/have_archive.require @@ -0,0 +1,2 @@ +Variable_name Value +have_archive YES diff --git a/mysql-test/r/have_geometry.require b/mysql-test/r/have_geometry.require new file mode 100644 index 00000000000..ba515a4bbb6 --- /dev/null +++ b/mysql-test/r/have_geometry.require @@ -0,0 +1,2 @@ +Variable_name Value +have_geometry YES diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 5592524cc39..e88ece6b361 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -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); diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 01114104088..b9f4f62e882 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -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 diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result new file mode 100644 index 00000000000..ccf855a927b --- /dev/null +++ b/mysql-test/r/ps.result @@ -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; diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result new file mode 100644 index 00000000000..8d42957c9d3 --- /dev/null +++ b/mysql-test/r/rpl_charset.result @@ -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; diff --git a/mysql-test/r/rpl_delete_all.result b/mysql-test/r/rpl_delete_all.result new file mode 100644 index 00000000000..9966d73f3dd --- /dev/null +++ b/mysql-test/r/rpl_delete_all.result @@ -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; diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result index 6992b635672..25177a6bca3 100644 --- a/mysql-test/r/rpl_flush_log_loop.result +++ b/mysql-test/r/rpl_flush_log_loop.result @@ -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 # diff --git a/mysql-test/r/rpl_ps.result b/mysql-test/r/rpl_ps.result new file mode 100644 index 00000000000..c969575de76 --- /dev/null +++ b/mysql-test/r/rpl_ps.result @@ -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; diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result index 43de4a67ce9..ca290d46fda 100644 --- a/mysql-test/r/rpl_replicate_do.result +++ b/mysql-test/r/rpl_replicate_do.result @@ -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 # diff --git a/mysql-test/r/rpl_server_id1.result b/mysql-test/r/rpl_server_id1.result index 8c383802de4..32e14b053d7 100644 --- a/mysql-test/r/rpl_server_id1.result +++ b/mysql-test/r/rpl_server_id1.result @@ -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; diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result index 465a1fed2b4..6900f29b9cb 100644 --- a/mysql-test/r/rpl_temporary.result +++ b/mysql-test/r/rpl_temporary.result @@ -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; diff --git a/mysql-test/r/rpl_user_variables.result b/mysql-test/r/rpl_user_variables.result index 71147772ac4..85768270ba3 100644 --- a/mysql-test/r/rpl_user_variables.result +++ b/mysql-test/r/rpl_user_variables.result @@ -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; diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result index 23a39a242a1..470a3e8439f 100644 --- a/mysql-test/r/select_found.result +++ b/mysql-test/r/select_found.result @@ -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; diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index a9351d2f1fb..2750478c1c5 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -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; diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test new file mode 100644 index 00000000000..5c2e73e5af7 --- /dev/null +++ b/mysql-test/t/archive.test @@ -0,0 +1,1300 @@ +# +# Simple test for archive example +# Taken fromm the select test +# +-- source include/have_archive.inc + +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + +CREATE TABLE t1 ( + Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, + Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL +) ENGINE=archive; + +INSERT INTO t1 VALUES (9410,9412); + +select period from t1; +select * from t1; +select t1.* from t1; + +# +# Create test table +# + +CREATE TABLE t2 ( + auto int, + fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL, + companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL, + fld3 char(30) DEFAULT '' NOT NULL, + fld4 char(35) DEFAULT '' NOT NULL, + fld5 char(35) DEFAULT '' NOT NULL, + fld6 char(4) DEFAULT '' NOT NULL +) ENGINE=archive; + +# +# Populate table +# + +--disable_query_log +INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat',''); +INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W'); +INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring',''); +INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily',''); +INSERT INTO t2 VALUES (5,011501,37,'bewilderingly','wallet','balled',''); +INSERT INTO t2 VALUES (6,011701,37,'astound','parters','persist','W'); +INSERT INTO t2 VALUES (7,011702,37,'admonishing','eschew','attainments',''); +INSERT INTO t2 VALUES (8,011703,37,'sumac','quitter','fanatic',''); +INSERT INTO t2 VALUES (9,012001,37,'flanking','neat','measures','FAS'); +INSERT INTO t2 VALUES (10,012003,37,'combed','Steinberg','rightfulness',''); +INSERT INTO t2 VALUES (11,012004,37,'subjective','jarring','capably',''); +INSERT INTO t2 VALUES (12,012005,37,'scatterbrain','tinily','impulsive',''); +INSERT INTO t2 VALUES (13,012301,37,'Eulerian','balled','starlet',''); +INSERT INTO t2 VALUES (14,012302,36,'dubbed','persist','terminators',''); +INSERT INTO t2 VALUES (15,012303,37,'Kane','attainments','untying',''); +INSERT INTO t2 VALUES (16,012304,37,'overlay','fanatic','announces','FAS'); +INSERT INTO t2 VALUES (17,012305,37,'perturb','measures','featherweight','FAS'); +INSERT INTO t2 VALUES (18,012306,37,'goblins','rightfulness','pessimist','FAS'); +INSERT INTO t2 VALUES (19,012501,37,'annihilates','capably','daughter',''); +INSERT INTO t2 VALUES (20,012602,37,'Wotan','impulsive','decliner','FAS'); +INSERT INTO t2 VALUES (21,012603,37,'snatching','starlet','lawgiver',''); +INSERT INTO t2 VALUES (22,012604,37,'concludes','terminators','stated',''); +INSERT INTO t2 VALUES (23,012605,37,'laterally','untying','readable',''); +INSERT INTO t2 VALUES (24,012606,37,'yelped','announces','attrition',''); +INSERT INTO t2 VALUES (25,012701,37,'grazing','featherweight','cascade','FAS'); +INSERT INTO t2 VALUES (26,012702,37,'Baird','pessimist','motors','FAS'); +INSERT INTO t2 VALUES (27,012703,37,'celery','daughter','interrogate',''); +INSERT INTO t2 VALUES (28,012704,37,'misunderstander','decliner','pests','W'); +INSERT INTO t2 VALUES (29,013601,37,'handgun','lawgiver','stairway',''); +INSERT INTO t2 VALUES (30,013602,37,'foldout','stated','dopers','FAS'); +INSERT INTO t2 VALUES (31,013603,37,'mystic','readable','testicle','W'); +INSERT INTO t2 VALUES (32,013604,37,'succumbed','attrition','Parsifal','W'); +INSERT INTO t2 VALUES (33,013605,37,'Nabisco','cascade','leavings',''); +INSERT INTO t2 VALUES (34,013606,37,'fingerings','motors','postulation','W'); +INSERT INTO t2 VALUES (35,013607,37,'aging','interrogate','squeaking',''); +INSERT INTO t2 VALUES (36,013608,37,'afield','pests','contrasted',''); +INSERT INTO t2 VALUES (37,013609,37,'ammonium','stairway','leftover',''); +INSERT INTO t2 VALUES (38,013610,37,'boat','dopers','whiteners',''); +INSERT INTO t2 VALUES (39,013801,37,'intelligibility','testicle','erases','W'); +INSERT INTO t2 VALUES (40,013802,37,'Augustine','Parsifal','Punjab','W'); +INSERT INTO t2 VALUES (41,013803,37,'teethe','leavings','Merritt',''); +INSERT INTO t2 VALUES (42,013804,37,'dreaded','postulation','Quixotism',''); +INSERT INTO t2 VALUES (43,013901,37,'scholastics','squeaking','sweetish','FAS'); +INSERT INTO t2 VALUES (44,016001,37,'audiology','contrasted','dogging','FAS'); +INSERT INTO t2 VALUES (45,016201,37,'wallet','leftover','scornfully','FAS'); +INSERT INTO t2 VALUES (46,016202,37,'parters','whiteners','bellow',''); +INSERT INTO t2 VALUES (47,016301,37,'eschew','erases','bills',''); +INSERT INTO t2 VALUES (48,016302,37,'quitter','Punjab','cupboard','FAS'); +INSERT INTO t2 VALUES (49,016303,37,'neat','Merritt','sureties','FAS'); +INSERT INTO t2 VALUES (50,016304,37,'Steinberg','Quixotism','puddings',''); +INSERT INTO t2 VALUES (51,018001,37,'jarring','sweetish','tapestry',''); +INSERT INTO t2 VALUES (52,018002,37,'tinily','dogging','fetters',''); +INSERT INTO t2 VALUES (53,018003,37,'balled','scornfully','bivalves',''); +INSERT INTO t2 VALUES (54,018004,37,'persist','bellow','incurring',''); +INSERT INTO t2 VALUES (55,018005,37,'attainments','bills','Adolph',''); +INSERT INTO t2 VALUES (56,018007,37,'fanatic','cupboard','pithed',''); +INSERT INTO t2 VALUES (57,018008,37,'measures','sureties','emergency',''); +INSERT INTO t2 VALUES (58,018009,37,'rightfulness','puddings','Miles',''); +INSERT INTO t2 VALUES (59,018010,37,'capably','tapestry','trimmings',''); +INSERT INTO t2 VALUES (60,018012,37,'impulsive','fetters','tragedies','W'); +INSERT INTO t2 VALUES (61,018013,37,'starlet','bivalves','skulking','W'); +INSERT INTO t2 VALUES (62,018014,37,'terminators','incurring','flint',''); +INSERT INTO t2 VALUES (63,018015,37,'untying','Adolph','flopping','W'); +INSERT INTO t2 VALUES (64,018016,37,'announces','pithed','relaxing','FAS'); +INSERT INTO t2 VALUES (65,018017,37,'featherweight','emergency','offload','FAS'); +INSERT INTO t2 VALUES (66,018018,37,'pessimist','Miles','suites','W'); +INSERT INTO t2 VALUES (67,018019,37,'daughter','trimmings','lists','FAS'); +INSERT INTO t2 VALUES (68,018020,37,'decliner','tragedies','animized','FAS'); +INSERT INTO t2 VALUES (69,018021,37,'lawgiver','skulking','multilayer','W'); +INSERT INTO t2 VALUES (70,018022,37,'stated','flint','standardizes','FAS'); +INSERT INTO t2 VALUES (71,018023,37,'readable','flopping','Judas',''); +INSERT INTO t2 VALUES (72,018024,37,'attrition','relaxing','vacuuming','W'); +INSERT INTO t2 VALUES (73,018025,37,'cascade','offload','dentally','W'); +INSERT INTO t2 VALUES (74,018026,37,'motors','suites','humanness','W'); +INSERT INTO t2 VALUES (75,018027,37,'interrogate','lists','inch','W'); +INSERT INTO t2 VALUES (76,018028,37,'pests','animized','Weissmuller','W'); +INSERT INTO t2 VALUES (77,018029,37,'stairway','multilayer','irresponsibly','W'); +INSERT INTO t2 VALUES (78,018030,37,'dopers','standardizes','luckily','FAS'); +INSERT INTO t2 VALUES (79,018032,37,'testicle','Judas','culled','W'); +INSERT INTO t2 VALUES (80,018033,37,'Parsifal','vacuuming','medical','FAS'); +INSERT INTO t2 VALUES (81,018034,37,'leavings','dentally','bloodbath','FAS'); +INSERT INTO t2 VALUES (82,018035,37,'postulation','humanness','subschema','W'); +INSERT INTO t2 VALUES (83,018036,37,'squeaking','inch','animals','W'); +INSERT INTO t2 VALUES (84,018037,37,'contrasted','Weissmuller','Micronesia',''); +INSERT INTO t2 VALUES (85,018038,37,'leftover','irresponsibly','repetitions',''); +INSERT INTO t2 VALUES (86,018039,37,'whiteners','luckily','Antares',''); +INSERT INTO t2 VALUES (87,018040,37,'erases','culled','ventilate','W'); +INSERT INTO t2 VALUES (88,018041,37,'Punjab','medical','pityingly',''); +INSERT INTO t2 VALUES (89,018042,37,'Merritt','bloodbath','interdependent',''); +INSERT INTO t2 VALUES (90,018043,37,'Quixotism','subschema','Graves','FAS'); +INSERT INTO t2 VALUES (91,018044,37,'sweetish','animals','neonatal',''); +INSERT INTO t2 VALUES (92,018045,37,'dogging','Micronesia','scribbled','FAS'); +INSERT INTO t2 VALUES (93,018046,37,'scornfully','repetitions','chafe','W'); +INSERT INTO t2 VALUES (94,018048,37,'bellow','Antares','honoring',''); +INSERT INTO t2 VALUES (95,018049,37,'bills','ventilate','realtor',''); +INSERT INTO t2 VALUES (96,018050,37,'cupboard','pityingly','elite',''); +INSERT INTO t2 VALUES (97,018051,37,'sureties','interdependent','funereal',''); +INSERT INTO t2 VALUES (98,018052,37,'puddings','Graves','abrogating',''); +INSERT INTO t2 VALUES (99,018053,50,'tapestry','neonatal','sorters',''); +INSERT INTO t2 VALUES (100,018054,37,'fetters','scribbled','Conley',''); +INSERT INTO t2 VALUES (101,018055,37,'bivalves','chafe','lectured',''); +INSERT INTO t2 VALUES (102,018056,37,'incurring','honoring','Abraham',''); +INSERT INTO t2 VALUES (103,018057,37,'Adolph','realtor','Hawaii','W'); +INSERT INTO t2 VALUES (104,018058,37,'pithed','elite','cage',''); +INSERT INTO t2 VALUES (105,018059,36,'emergency','funereal','hushes',''); +INSERT INTO t2 VALUES (106,018060,37,'Miles','abrogating','Simla',''); +INSERT INTO t2 VALUES (107,018061,37,'trimmings','sorters','reporters',''); +INSERT INTO t2 VALUES (108,018101,37,'tragedies','Conley','Dutchman','FAS'); +INSERT INTO t2 VALUES (109,018102,37,'skulking','lectured','descendants','FAS'); +INSERT INTO t2 VALUES (110,018103,37,'flint','Abraham','groupings','FAS'); +INSERT INTO t2 VALUES (111,018104,37,'flopping','Hawaii','dissociate',''); +INSERT INTO t2 VALUES (112,018201,37,'relaxing','cage','coexist','W'); +INSERT INTO t2 VALUES (113,018202,37,'offload','hushes','Beebe',''); +INSERT INTO t2 VALUES (114,018402,37,'suites','Simla','Taoism',''); +INSERT INTO t2 VALUES (115,018403,37,'lists','reporters','Connally',''); +INSERT INTO t2 VALUES (116,018404,37,'animized','Dutchman','fetched','FAS'); +INSERT INTO t2 VALUES (117,018405,37,'multilayer','descendants','checkpoints','FAS'); +INSERT INTO t2 VALUES (118,018406,37,'standardizes','groupings','rusting',''); +INSERT INTO t2 VALUES (119,018409,37,'Judas','dissociate','galling',''); +INSERT INTO t2 VALUES (120,018601,37,'vacuuming','coexist','obliterates',''); +INSERT INTO t2 VALUES (121,018602,37,'dentally','Beebe','traitor',''); +INSERT INTO t2 VALUES (122,018603,37,'humanness','Taoism','resumes','FAS'); +INSERT INTO t2 VALUES (123,018801,37,'inch','Connally','analyzable','FAS'); +INSERT INTO t2 VALUES (124,018802,37,'Weissmuller','fetched','terminator','FAS'); +INSERT INTO t2 VALUES (125,018803,37,'irresponsibly','checkpoints','gritty','FAS'); +INSERT INTO t2 VALUES (126,018804,37,'luckily','rusting','firearm','W'); +INSERT INTO t2 VALUES (127,018805,37,'culled','galling','minima',''); +INSERT INTO t2 VALUES (128,018806,37,'medical','obliterates','Selfridge',''); +INSERT INTO t2 VALUES (129,018807,37,'bloodbath','traitor','disable',''); +INSERT INTO t2 VALUES (130,018808,37,'subschema','resumes','witchcraft','W'); +INSERT INTO t2 VALUES (131,018809,37,'animals','analyzable','betroth','W'); +INSERT INTO t2 VALUES (132,018810,37,'Micronesia','terminator','Manhattanize',''); +INSERT INTO t2 VALUES (133,018811,37,'repetitions','gritty','imprint',''); +INSERT INTO t2 VALUES (134,018812,37,'Antares','firearm','peeked',''); +INSERT INTO t2 VALUES (135,019101,37,'ventilate','minima','swelling',''); +INSERT INTO t2 VALUES (136,019102,37,'pityingly','Selfridge','interrelationships','W'); +INSERT INTO t2 VALUES (137,019103,37,'interdependent','disable','riser',''); +INSERT INTO t2 VALUES (138,019201,37,'Graves','witchcraft','Gandhian','W'); +INSERT INTO t2 VALUES (139,030501,37,'neonatal','betroth','peacock','A'); +INSERT INTO t2 VALUES (140,030502,50,'scribbled','Manhattanize','bee','A'); +INSERT INTO t2 VALUES (141,030503,37,'chafe','imprint','kanji',''); +INSERT INTO t2 VALUES (142,030504,37,'honoring','peeked','dental',''); +INSERT INTO t2 VALUES (143,031901,37,'realtor','swelling','scarf','FAS'); +INSERT INTO t2 VALUES (144,036001,37,'elite','interrelationships','chasm','A'); +INSERT INTO t2 VALUES (145,036002,37,'funereal','riser','insolence','A'); +INSERT INTO t2 VALUES (146,036004,37,'abrogating','Gandhian','syndicate',''); +INSERT INTO t2 VALUES (147,036005,37,'sorters','peacock','alike',''); +INSERT INTO t2 VALUES (148,038001,37,'Conley','bee','imperial','A'); +INSERT INTO t2 VALUES (149,038002,37,'lectured','kanji','convulsion','A'); +INSERT INTO t2 VALUES (150,038003,37,'Abraham','dental','railway','A'); +INSERT INTO t2 VALUES (151,038004,37,'Hawaii','scarf','validate','A'); +INSERT INTO t2 VALUES (152,038005,37,'cage','chasm','normalizes','A'); +INSERT INTO t2 VALUES (153,038006,37,'hushes','insolence','comprehensive',''); +INSERT INTO t2 VALUES (154,038007,37,'Simla','syndicate','chewing',''); +INSERT INTO t2 VALUES (155,038008,37,'reporters','alike','denizen',''); +INSERT INTO t2 VALUES (156,038009,37,'Dutchman','imperial','schemer',''); +INSERT INTO t2 VALUES (157,038010,37,'descendants','convulsion','chronicle',''); +INSERT INTO t2 VALUES (158,038011,37,'groupings','railway','Kline',''); +INSERT INTO t2 VALUES (159,038012,37,'dissociate','validate','Anatole',''); +INSERT INTO t2 VALUES (160,038013,37,'coexist','normalizes','partridges',''); +INSERT INTO t2 VALUES (161,038014,37,'Beebe','comprehensive','brunch',''); +INSERT INTO t2 VALUES (162,038015,37,'Taoism','chewing','recruited',''); +INSERT INTO t2 VALUES (163,038016,37,'Connally','denizen','dimensions','W'); +INSERT INTO t2 VALUES (164,038017,37,'fetched','schemer','Chicana','W'); +INSERT INTO t2 VALUES (165,038018,37,'checkpoints','chronicle','announced',''); +INSERT INTO t2 VALUES (166,038101,37,'rusting','Kline','praised','FAS'); +INSERT INTO t2 VALUES (167,038102,37,'galling','Anatole','employing',''); +INSERT INTO t2 VALUES (168,038103,37,'obliterates','partridges','linear',''); +INSERT INTO t2 VALUES (169,038104,37,'traitor','brunch','quagmire',''); +INSERT INTO t2 VALUES (170,038201,37,'resumes','recruited','western','A'); +INSERT INTO t2 VALUES (171,038202,37,'analyzable','dimensions','relishing',''); +INSERT INTO t2 VALUES (172,038203,37,'terminator','Chicana','serving','A'); +INSERT INTO t2 VALUES (173,038204,37,'gritty','announced','scheduling',''); +INSERT INTO t2 VALUES (174,038205,37,'firearm','praised','lore',''); +INSERT INTO t2 VALUES (175,038206,37,'minima','employing','eventful',''); +INSERT INTO t2 VALUES (176,038208,37,'Selfridge','linear','arteriole','A'); +INSERT INTO t2 VALUES (177,042801,37,'disable','quagmire','disentangle',''); +INSERT INTO t2 VALUES (178,042802,37,'witchcraft','western','cured','A'); +INSERT INTO t2 VALUES (179,046101,37,'betroth','relishing','Fenton','W'); +INSERT INTO t2 VALUES (180,048001,37,'Manhattanize','serving','avoidable','A'); +INSERT INTO t2 VALUES (181,048002,37,'imprint','scheduling','drains','A'); +INSERT INTO t2 VALUES (182,048003,37,'peeked','lore','detectably','FAS'); +INSERT INTO t2 VALUES (183,048004,37,'swelling','eventful','husky',''); +INSERT INTO t2 VALUES (184,048005,37,'interrelationships','arteriole','impelling',''); +INSERT INTO t2 VALUES (185,048006,37,'riser','disentangle','undoes',''); +INSERT INTO t2 VALUES (186,048007,37,'Gandhian','cured','evened',''); +INSERT INTO t2 VALUES (187,048008,37,'peacock','Fenton','squeezes',''); +INSERT INTO t2 VALUES (188,048101,37,'bee','avoidable','destroyer','FAS'); +INSERT INTO t2 VALUES (189,048102,37,'kanji','drains','rudeness',''); +INSERT INTO t2 VALUES (190,048201,37,'dental','detectably','beaner','FAS'); +INSERT INTO t2 VALUES (191,048202,37,'scarf','husky','boorish',''); +INSERT INTO t2 VALUES (192,048203,37,'chasm','impelling','Everhart',''); +INSERT INTO t2 VALUES (193,048204,37,'insolence','undoes','encompass','A'); +INSERT INTO t2 VALUES (194,048205,37,'syndicate','evened','mushrooms',''); +INSERT INTO t2 VALUES (195,048301,37,'alike','squeezes','Alison','A'); +INSERT INTO t2 VALUES (196,048302,37,'imperial','destroyer','externally','FAS'); +INSERT INTO t2 VALUES (197,048303,37,'convulsion','rudeness','pellagra',''); +INSERT INTO t2 VALUES (198,048304,37,'railway','beaner','cult',''); +INSERT INTO t2 VALUES (199,048305,37,'validate','boorish','creek','A'); +INSERT INTO t2 VALUES (200,048401,37,'normalizes','Everhart','Huffman',''); +INSERT INTO t2 VALUES (201,048402,37,'comprehensive','encompass','Majorca','FAS'); +INSERT INTO t2 VALUES (202,048403,37,'chewing','mushrooms','governing','A'); +INSERT INTO t2 VALUES (203,048404,37,'denizen','Alison','gadfly','FAS'); +INSERT INTO t2 VALUES (204,048405,37,'schemer','externally','reassigned','FAS'); +INSERT INTO t2 VALUES (205,048406,37,'chronicle','pellagra','intentness','W'); +INSERT INTO t2 VALUES (206,048407,37,'Kline','cult','craziness',''); +INSERT INTO t2 VALUES (207,048408,37,'Anatole','creek','psychic',''); +INSERT INTO t2 VALUES (208,048409,37,'partridges','Huffman','squabbled',''); +INSERT INTO t2 VALUES (209,048410,37,'brunch','Majorca','burlesque',''); +INSERT INTO t2 VALUES (210,048411,37,'recruited','governing','capped',''); +INSERT INTO t2 VALUES (211,048412,37,'dimensions','gadfly','extracted','A'); +INSERT INTO t2 VALUES (212,048413,37,'Chicana','reassigned','DiMaggio',''); +INSERT INTO t2 VALUES (213,048601,37,'announced','intentness','exclamation','FAS'); +INSERT INTO t2 VALUES (214,048602,37,'praised','craziness','subdirectory',''); +INSERT INTO t2 VALUES (215,048603,37,'employing','psychic','fangs',''); +INSERT INTO t2 VALUES (216,048604,37,'linear','squabbled','buyer','A'); +INSERT INTO t2 VALUES (217,048801,37,'quagmire','burlesque','pithing','A'); +INSERT INTO t2 VALUES (218,050901,37,'western','capped','transistorizing','A'); +INSERT INTO t2 VALUES (219,051201,37,'relishing','extracted','nonbiodegradable',''); +INSERT INTO t2 VALUES (220,056002,37,'serving','DiMaggio','dislocate',''); +INSERT INTO t2 VALUES (221,056003,37,'scheduling','exclamation','monochromatic','FAS'); +INSERT INTO t2 VALUES (222,056004,37,'lore','subdirectory','batting',''); +INSERT INTO t2 VALUES (223,056102,37,'eventful','fangs','postcondition','A'); +INSERT INTO t2 VALUES (224,056203,37,'arteriole','buyer','catalog','FAS'); +INSERT INTO t2 VALUES (225,056204,37,'disentangle','pithing','Remus',''); +INSERT INTO t2 VALUES (226,058003,37,'cured','transistorizing','devices','A'); +INSERT INTO t2 VALUES (227,058004,37,'Fenton','nonbiodegradable','bike','A'); +INSERT INTO t2 VALUES (228,058005,37,'avoidable','dislocate','qualify',''); +INSERT INTO t2 VALUES (229,058006,37,'drains','monochromatic','detained',''); +INSERT INTO t2 VALUES (230,058007,37,'detectably','batting','commended',''); +INSERT INTO t2 VALUES (231,058101,37,'husky','postcondition','civilize',''); +INSERT INTO t2 VALUES (232,058102,37,'impelling','catalog','Elmhurst',''); +INSERT INTO t2 VALUES (233,058103,37,'undoes','Remus','anesthetizing',''); +INSERT INTO t2 VALUES (234,058105,37,'evened','devices','deaf',''); +INSERT INTO t2 VALUES (235,058111,37,'squeezes','bike','Brigham',''); +INSERT INTO t2 VALUES (236,058112,37,'destroyer','qualify','title',''); +INSERT INTO t2 VALUES (237,058113,37,'rudeness','detained','coarse',''); +INSERT INTO t2 VALUES (238,058114,37,'beaner','commended','combinations',''); +INSERT INTO t2 VALUES (239,058115,37,'boorish','civilize','grayness',''); +INSERT INTO t2 VALUES (240,058116,37,'Everhart','Elmhurst','innumerable','FAS'); +INSERT INTO t2 VALUES (241,058117,37,'encompass','anesthetizing','Caroline','A'); +INSERT INTO t2 VALUES (242,058118,37,'mushrooms','deaf','fatty','FAS'); +INSERT INTO t2 VALUES (243,058119,37,'Alison','Brigham','eastbound',''); +INSERT INTO t2 VALUES (244,058120,37,'externally','title','inexperienced',''); +INSERT INTO t2 VALUES (245,058121,37,'pellagra','coarse','hoarder','A'); +INSERT INTO t2 VALUES (246,058122,37,'cult','combinations','scotch','W'); +INSERT INTO t2 VALUES (247,058123,37,'creek','grayness','passport','A'); +INSERT INTO t2 VALUES (248,058124,37,'Huffman','innumerable','strategic','FAS'); +INSERT INTO t2 VALUES (249,058125,37,'Majorca','Caroline','gated',''); +INSERT INTO t2 VALUES (250,058126,37,'governing','fatty','flog',''); +INSERT INTO t2 VALUES (251,058127,37,'gadfly','eastbound','Pipestone',''); +INSERT INTO t2 VALUES (252,058128,37,'reassigned','inexperienced','Dar',''); +INSERT INTO t2 VALUES (253,058201,37,'intentness','hoarder','Corcoran',''); +INSERT INTO t2 VALUES (254,058202,37,'craziness','scotch','flyers','A'); +INSERT INTO t2 VALUES (255,058303,37,'psychic','passport','competitions','W'); +INSERT INTO t2 VALUES (256,058304,37,'squabbled','strategic','suppliers','FAS'); +INSERT INTO t2 VALUES (257,058602,37,'burlesque','gated','skips',''); +INSERT INTO t2 VALUES (258,058603,37,'capped','flog','institutes',''); +INSERT INTO t2 VALUES (259,058604,37,'extracted','Pipestone','troop','A'); +INSERT INTO t2 VALUES (260,058605,37,'DiMaggio','Dar','connective','W'); +INSERT INTO t2 VALUES (261,058606,37,'exclamation','Corcoran','denies',''); +INSERT INTO t2 VALUES (262,058607,37,'subdirectory','flyers','polka',''); +INSERT INTO t2 VALUES (263,060401,36,'fangs','competitions','observations','FAS'); +INSERT INTO t2 VALUES (264,061701,36,'buyer','suppliers','askers',''); +INSERT INTO t2 VALUES (265,066201,36,'pithing','skips','homeless','FAS'); +INSERT INTO t2 VALUES (266,066501,36,'transistorizing','institutes','Anna',''); +INSERT INTO t2 VALUES (267,068001,36,'nonbiodegradable','troop','subdirectories','W'); +INSERT INTO t2 VALUES (268,068002,36,'dislocate','connective','decaying','FAS'); +INSERT INTO t2 VALUES (269,068005,36,'monochromatic','denies','outwitting','W'); +INSERT INTO t2 VALUES (270,068006,36,'batting','polka','Harpy','W'); +INSERT INTO t2 VALUES (271,068007,36,'postcondition','observations','crazed',''); +INSERT INTO t2 VALUES (272,068008,36,'catalog','askers','suffocate',''); +INSERT INTO t2 VALUES (273,068009,36,'Remus','homeless','provers','FAS'); +INSERT INTO t2 VALUES (274,068010,36,'devices','Anna','technically',''); +INSERT INTO t2 VALUES (275,068011,36,'bike','subdirectories','Franklinizations',''); +INSERT INTO t2 VALUES (276,068202,36,'qualify','decaying','considered',''); +INSERT INTO t2 VALUES (277,068302,36,'detained','outwitting','tinnily',''); +INSERT INTO t2 VALUES (278,068303,36,'commended','Harpy','uninterruptedly',''); +INSERT INTO t2 VALUES (279,068401,36,'civilize','crazed','whistled','A'); +INSERT INTO t2 VALUES (280,068501,36,'Elmhurst','suffocate','automate',''); +INSERT INTO t2 VALUES (281,068502,36,'anesthetizing','provers','gutting','W'); +INSERT INTO t2 VALUES (282,068503,36,'deaf','technically','surreptitious',''); +INSERT INTO t2 VALUES (283,068602,36,'Brigham','Franklinizations','Choctaw',''); +INSERT INTO t2 VALUES (284,068603,36,'title','considered','cooks',''); +INSERT INTO t2 VALUES (285,068701,36,'coarse','tinnily','millivolt','FAS'); +INSERT INTO t2 VALUES (286,068702,36,'combinations','uninterruptedly','counterpoise',''); +INSERT INTO t2 VALUES (287,068703,36,'grayness','whistled','Gothicism',''); +INSERT INTO t2 VALUES (288,076001,36,'innumerable','automate','feminine',''); +INSERT INTO t2 VALUES (289,076002,36,'Caroline','gutting','metaphysically','W'); +INSERT INTO t2 VALUES (290,076101,36,'fatty','surreptitious','sanding','A'); +INSERT INTO t2 VALUES (291,076102,36,'eastbound','Choctaw','contributorily',''); +INSERT INTO t2 VALUES (292,076103,36,'inexperienced','cooks','receivers','FAS'); +INSERT INTO t2 VALUES (293,076302,36,'hoarder','millivolt','adjourn',''); +INSERT INTO t2 VALUES (294,076303,36,'scotch','counterpoise','straggled','A'); +INSERT INTO t2 VALUES (295,076304,36,'passport','Gothicism','druggists',''); +INSERT INTO t2 VALUES (296,076305,36,'strategic','feminine','thanking','FAS'); +INSERT INTO t2 VALUES (297,076306,36,'gated','metaphysically','ostrich',''); +INSERT INTO t2 VALUES (298,076307,36,'flog','sanding','hopelessness','FAS'); +INSERT INTO t2 VALUES (299,076402,36,'Pipestone','contributorily','Eurydice',''); +INSERT INTO t2 VALUES (300,076501,36,'Dar','receivers','excitation','W'); +INSERT INTO t2 VALUES (301,076502,36,'Corcoran','adjourn','presumes','FAS'); +INSERT INTO t2 VALUES (302,076701,36,'flyers','straggled','imaginable','FAS'); +INSERT INTO t2 VALUES (303,078001,36,'competitions','druggists','concoct','W'); +INSERT INTO t2 VALUES (304,078002,36,'suppliers','thanking','peering','W'); +INSERT INTO t2 VALUES (305,078003,36,'skips','ostrich','Phelps','FAS'); +INSERT INTO t2 VALUES (306,078004,36,'institutes','hopelessness','ferociousness','FAS'); +INSERT INTO t2 VALUES (307,078005,36,'troop','Eurydice','sentences',''); +INSERT INTO t2 VALUES (308,078006,36,'connective','excitation','unlocks',''); +INSERT INTO t2 VALUES (309,078007,36,'denies','presumes','engrossing','W'); +INSERT INTO t2 VALUES (310,078008,36,'polka','imaginable','Ruth',''); +INSERT INTO t2 VALUES (311,078101,36,'observations','concoct','tying',''); +INSERT INTO t2 VALUES (312,078103,36,'askers','peering','exclaimers',''); +INSERT INTO t2 VALUES (313,078104,36,'homeless','Phelps','synergy',''); +INSERT INTO t2 VALUES (314,078105,36,'Anna','ferociousness','Huey','W'); +INSERT INTO t2 VALUES (315,082101,36,'subdirectories','sentences','merging',''); +INSERT INTO t2 VALUES (316,083401,36,'decaying','unlocks','judges','A'); +INSERT INTO t2 VALUES (317,084001,36,'outwitting','engrossing','Shylock','W'); +INSERT INTO t2 VALUES (318,084002,36,'Harpy','Ruth','Miltonism',''); +INSERT INTO t2 VALUES (319,086001,36,'crazed','tying','hen','W'); +INSERT INTO t2 VALUES (320,086102,36,'suffocate','exclaimers','honeybee','FAS'); +INSERT INTO t2 VALUES (321,086201,36,'provers','synergy','towers',''); +INSERT INTO t2 VALUES (322,088001,36,'technically','Huey','dilutes','W'); +INSERT INTO t2 VALUES (323,088002,36,'Franklinizations','merging','numerals','FAS'); +INSERT INTO t2 VALUES (324,088003,36,'considered','judges','democracy','FAS'); +INSERT INTO t2 VALUES (325,088004,36,'tinnily','Shylock','Ibero-',''); +INSERT INTO t2 VALUES (326,088101,36,'uninterruptedly','Miltonism','invalids',''); +INSERT INTO t2 VALUES (327,088102,36,'whistled','hen','behavior',''); +INSERT INTO t2 VALUES (328,088103,36,'automate','honeybee','accruing',''); +INSERT INTO t2 VALUES (329,088104,36,'gutting','towers','relics','A'); +INSERT INTO t2 VALUES (330,088105,36,'surreptitious','dilutes','rackets',''); +INSERT INTO t2 VALUES (331,088106,36,'Choctaw','numerals','Fischbein','W'); +INSERT INTO t2 VALUES (332,088201,36,'cooks','democracy','phony','W'); +INSERT INTO t2 VALUES (333,088203,36,'millivolt','Ibero-','cross','FAS'); +INSERT INTO t2 VALUES (334,088204,36,'counterpoise','invalids','cleanup',''); +INSERT INTO t2 VALUES (335,088302,37,'Gothicism','behavior','conspirator',''); +INSERT INTO t2 VALUES (336,088303,37,'feminine','accruing','label','FAS'); +INSERT INTO t2 VALUES (337,088305,37,'metaphysically','relics','university',''); +INSERT INTO t2 VALUES (338,088402,37,'sanding','rackets','cleansed','FAS'); +INSERT INTO t2 VALUES (339,088501,36,'contributorily','Fischbein','ballgown',''); +INSERT INTO t2 VALUES (340,088502,36,'receivers','phony','starlet',''); +INSERT INTO t2 VALUES (341,088503,36,'adjourn','cross','aqueous',''); +INSERT INTO t2 VALUES (342,098001,58,'straggled','cleanup','portrayal','A'); +INSERT INTO t2 VALUES (343,098002,58,'druggists','conspirator','despising','W'); +INSERT INTO t2 VALUES (344,098003,58,'thanking','label','distort','W'); +INSERT INTO t2 VALUES (345,098004,58,'ostrich','university','palmed',''); +INSERT INTO t2 VALUES (346,098005,58,'hopelessness','cleansed','faced',''); +INSERT INTO t2 VALUES (347,098006,58,'Eurydice','ballgown','silverware',''); +INSERT INTO t2 VALUES (348,141903,29,'excitation','starlet','assessor',''); +INSERT INTO t2 VALUES (349,098008,58,'presumes','aqueous','spiders',''); +INSERT INTO t2 VALUES (350,098009,58,'imaginable','portrayal','artificially',''); +INSERT INTO t2 VALUES (351,098010,58,'concoct','despising','reminiscence',''); +INSERT INTO t2 VALUES (352,098011,58,'peering','distort','Mexican',''); +INSERT INTO t2 VALUES (353,098012,58,'Phelps','palmed','obnoxious',''); +INSERT INTO t2 VALUES (354,098013,58,'ferociousness','faced','fragile',''); +INSERT INTO t2 VALUES (355,098014,58,'sentences','silverware','apprehensible',''); +INSERT INTO t2 VALUES (356,098015,58,'unlocks','assessor','births',''); +INSERT INTO t2 VALUES (357,098016,58,'engrossing','spiders','garages',''); +INSERT INTO t2 VALUES (358,098017,58,'Ruth','artificially','panty',''); +INSERT INTO t2 VALUES (359,098018,58,'tying','reminiscence','anteater',''); +INSERT INTO t2 VALUES (360,098019,58,'exclaimers','Mexican','displacement','A'); +INSERT INTO t2 VALUES (361,098020,58,'synergy','obnoxious','drovers','A'); +INSERT INTO t2 VALUES (362,098021,58,'Huey','fragile','patenting','A'); +INSERT INTO t2 VALUES (363,098022,58,'merging','apprehensible','far','A'); +INSERT INTO t2 VALUES (364,098023,58,'judges','births','shrieks',''); +INSERT INTO t2 VALUES (365,098024,58,'Shylock','garages','aligning','W'); +INSERT INTO t2 VALUES (366,098025,37,'Miltonism','panty','pragmatism',''); +INSERT INTO t2 VALUES (367,106001,36,'hen','anteater','fevers','W'); +INSERT INTO t2 VALUES (368,108001,36,'honeybee','displacement','reexamines','A'); +INSERT INTO t2 VALUES (369,108002,36,'towers','drovers','occupancies',''); +INSERT INTO t2 VALUES (370,108003,36,'dilutes','patenting','sweats','FAS'); +INSERT INTO t2 VALUES (371,108004,36,'numerals','far','modulators',''); +INSERT INTO t2 VALUES (372,108005,36,'democracy','shrieks','demand','W'); +INSERT INTO t2 VALUES (373,108007,36,'Ibero-','aligning','Madeira',''); +INSERT INTO t2 VALUES (374,108008,36,'invalids','pragmatism','Viennese','W'); +INSERT INTO t2 VALUES (375,108009,36,'behavior','fevers','chillier','W'); +INSERT INTO t2 VALUES (376,108010,36,'accruing','reexamines','wildcats','FAS'); +INSERT INTO t2 VALUES (377,108011,36,'relics','occupancies','gentle',''); +INSERT INTO t2 VALUES (378,108012,36,'rackets','sweats','Angles','W'); +INSERT INTO t2 VALUES (379,108101,36,'Fischbein','modulators','accuracies',''); +INSERT INTO t2 VALUES (380,108102,36,'phony','demand','toggle',''); +INSERT INTO t2 VALUES (381,108103,36,'cross','Madeira','Mendelssohn','W'); +INSERT INTO t2 VALUES (382,108111,50,'cleanup','Viennese','behaviorally',''); +INSERT INTO t2 VALUES (383,108105,36,'conspirator','chillier','Rochford',''); +INSERT INTO t2 VALUES (384,108106,36,'label','wildcats','mirror','W'); +INSERT INTO t2 VALUES (385,108107,36,'university','gentle','Modula',''); +INSERT INTO t2 VALUES (386,108108,50,'cleansed','Angles','clobbering',''); +INSERT INTO t2 VALUES (387,108109,36,'ballgown','accuracies','chronography',''); +INSERT INTO t2 VALUES (388,108110,36,'starlet','toggle','Eskimoizeds',''); +INSERT INTO t2 VALUES (389,108201,36,'aqueous','Mendelssohn','British','W'); +INSERT INTO t2 VALUES (390,108202,36,'portrayal','behaviorally','pitfalls',''); +INSERT INTO t2 VALUES (391,108203,36,'despising','Rochford','verify','W'); +INSERT INTO t2 VALUES (392,108204,36,'distort','mirror','scatter','FAS'); +INSERT INTO t2 VALUES (393,108205,36,'palmed','Modula','Aztecan',''); +INSERT INTO t2 VALUES (394,108301,36,'faced','clobbering','acuity','W'); +INSERT INTO t2 VALUES (395,108302,36,'silverware','chronography','sinking','W'); +INSERT INTO t2 VALUES (396,112101,36,'assessor','Eskimoizeds','beasts','FAS'); +INSERT INTO t2 VALUES (397,112102,36,'spiders','British','Witt','W'); +INSERT INTO t2 VALUES (398,113701,36,'artificially','pitfalls','physicists','FAS'); +INSERT INTO t2 VALUES (399,116001,36,'reminiscence','verify','folksong','A'); +INSERT INTO t2 VALUES (400,116201,36,'Mexican','scatter','strokes','FAS'); +INSERT INTO t2 VALUES (401,116301,36,'obnoxious','Aztecan','crowder',''); +INSERT INTO t2 VALUES (402,116302,36,'fragile','acuity','merry',''); +INSERT INTO t2 VALUES (403,116601,36,'apprehensible','sinking','cadenced',''); +INSERT INTO t2 VALUES (404,116602,36,'births','beasts','alimony','A'); +INSERT INTO t2 VALUES (405,116603,36,'garages','Witt','principled','A'); +INSERT INTO t2 VALUES (406,116701,36,'panty','physicists','golfing',''); +INSERT INTO t2 VALUES (407,116702,36,'anteater','folksong','undiscovered',''); +INSERT INTO t2 VALUES (408,118001,36,'displacement','strokes','irritates',''); +INSERT INTO t2 VALUES (409,118002,36,'drovers','crowder','patriots','A'); +INSERT INTO t2 VALUES (410,118003,36,'patenting','merry','rooms','FAS'); +INSERT INTO t2 VALUES (411,118004,36,'far','cadenced','towering','W'); +INSERT INTO t2 VALUES (412,118005,36,'shrieks','alimony','displease',''); +INSERT INTO t2 VALUES (413,118006,36,'aligning','principled','photosensitive',''); +INSERT INTO t2 VALUES (414,118007,36,'pragmatism','golfing','inking',''); +INSERT INTO t2 VALUES (415,118008,36,'fevers','undiscovered','gainers',''); +INSERT INTO t2 VALUES (416,118101,36,'reexamines','irritates','leaning','A'); +INSERT INTO t2 VALUES (417,118102,36,'occupancies','patriots','hydrant','A'); +INSERT INTO t2 VALUES (418,118103,36,'sweats','rooms','preserve',''); +INSERT INTO t2 VALUES (419,118202,36,'modulators','towering','blinded','A'); +INSERT INTO t2 VALUES (420,118203,36,'demand','displease','interactions','A'); +INSERT INTO t2 VALUES (421,118204,36,'Madeira','photosensitive','Barry',''); +INSERT INTO t2 VALUES (422,118302,36,'Viennese','inking','whiteness','A'); +INSERT INTO t2 VALUES (423,118304,36,'chillier','gainers','pastimes','W'); +INSERT INTO t2 VALUES (424,118305,36,'wildcats','leaning','Edenization',''); +INSERT INTO t2 VALUES (425,118306,36,'gentle','hydrant','Muscat',''); +INSERT INTO t2 VALUES (426,118307,36,'Angles','preserve','assassinated',''); +INSERT INTO t2 VALUES (427,123101,36,'accuracies','blinded','labeled',''); +INSERT INTO t2 VALUES (428,123102,36,'toggle','interactions','glacial','A'); +INSERT INTO t2 VALUES (429,123301,36,'Mendelssohn','Barry','implied','W'); +INSERT INTO t2 VALUES (430,126001,36,'behaviorally','whiteness','bibliographies','W'); +INSERT INTO t2 VALUES (431,126002,36,'Rochford','pastimes','Buchanan',''); +INSERT INTO t2 VALUES (432,126003,36,'mirror','Edenization','forgivably','FAS'); +INSERT INTO t2 VALUES (433,126101,36,'Modula','Muscat','innuendo','A'); +INSERT INTO t2 VALUES (434,126301,36,'clobbering','assassinated','den','FAS'); +INSERT INTO t2 VALUES (435,126302,36,'chronography','labeled','submarines','W'); +INSERT INTO t2 VALUES (436,126402,36,'Eskimoizeds','glacial','mouthful','A'); +INSERT INTO t2 VALUES (437,126601,36,'British','implied','expiring',''); +INSERT INTO t2 VALUES (438,126602,36,'pitfalls','bibliographies','unfulfilled','FAS'); +INSERT INTO t2 VALUES (439,126702,36,'verify','Buchanan','precession',''); +INSERT INTO t2 VALUES (440,128001,36,'scatter','forgivably','nullified',''); +INSERT INTO t2 VALUES (441,128002,36,'Aztecan','innuendo','affects',''); +INSERT INTO t2 VALUES (442,128003,36,'acuity','den','Cynthia',''); +INSERT INTO t2 VALUES (443,128004,36,'sinking','submarines','Chablis','A'); +INSERT INTO t2 VALUES (444,128005,36,'beasts','mouthful','betterments','FAS'); +INSERT INTO t2 VALUES (445,128007,36,'Witt','expiring','advertising',''); +INSERT INTO t2 VALUES (446,128008,36,'physicists','unfulfilled','rubies','A'); +INSERT INTO t2 VALUES (447,128009,36,'folksong','precession','southwest','FAS'); +INSERT INTO t2 VALUES (448,128010,36,'strokes','nullified','superstitious','A'); +INSERT INTO t2 VALUES (449,128011,36,'crowder','affects','tabernacle','W'); +INSERT INTO t2 VALUES (450,128012,36,'merry','Cynthia','silk','A'); +INSERT INTO t2 VALUES (451,128013,36,'cadenced','Chablis','handsomest','A'); +INSERT INTO t2 VALUES (452,128014,36,'alimony','betterments','Persian','A'); +INSERT INTO t2 VALUES (453,128015,36,'principled','advertising','analog','W'); +INSERT INTO t2 VALUES (454,128016,36,'golfing','rubies','complex','W'); +INSERT INTO t2 VALUES (455,128017,36,'undiscovered','southwest','Taoist',''); +INSERT INTO t2 VALUES (456,128018,36,'irritates','superstitious','suspend',''); +INSERT INTO t2 VALUES (457,128019,36,'patriots','tabernacle','relegated',''); +INSERT INTO t2 VALUES (458,128020,36,'rooms','silk','awesome','W'); +INSERT INTO t2 VALUES (459,128021,36,'towering','handsomest','Bruxelles',''); +INSERT INTO t2 VALUES (460,128022,36,'displease','Persian','imprecisely','A'); +INSERT INTO t2 VALUES (461,128023,36,'photosensitive','analog','televise',''); +INSERT INTO t2 VALUES (462,128101,36,'inking','complex','braking',''); +INSERT INTO t2 VALUES (463,128102,36,'gainers','Taoist','true','FAS'); +INSERT INTO t2 VALUES (464,128103,36,'leaning','suspend','disappointing','FAS'); +INSERT INTO t2 VALUES (465,128104,36,'hydrant','relegated','navally','W'); +INSERT INTO t2 VALUES (466,128106,36,'preserve','awesome','circus',''); +INSERT INTO t2 VALUES (467,128107,36,'blinded','Bruxelles','beetles',''); +INSERT INTO t2 VALUES (468,128108,36,'interactions','imprecisely','trumps',''); +INSERT INTO t2 VALUES (469,128202,36,'Barry','televise','fourscore','W'); +INSERT INTO t2 VALUES (470,128203,36,'whiteness','braking','Blackfoots',''); +INSERT INTO t2 VALUES (471,128301,36,'pastimes','true','Grady',''); +INSERT INTO t2 VALUES (472,128302,36,'Edenization','disappointing','quiets','FAS'); +INSERT INTO t2 VALUES (473,128303,36,'Muscat','navally','floundered','FAS'); +INSERT INTO t2 VALUES (474,128304,36,'assassinated','circus','profundity','W'); +INSERT INTO t2 VALUES (475,128305,36,'labeled','beetles','Garrisonian','W'); +INSERT INTO t2 VALUES (476,128307,36,'glacial','trumps','Strauss',''); +INSERT INTO t2 VALUES (477,128401,36,'implied','fourscore','cemented','FAS'); +INSERT INTO t2 VALUES (478,128502,36,'bibliographies','Blackfoots','contrition','A'); +INSERT INTO t2 VALUES (479,128503,36,'Buchanan','Grady','mutations',''); +INSERT INTO t2 VALUES (480,128504,36,'forgivably','quiets','exhibits','W'); +INSERT INTO t2 VALUES (481,128505,36,'innuendo','floundered','tits',''); +INSERT INTO t2 VALUES (482,128601,36,'den','profundity','mate','A'); +INSERT INTO t2 VALUES (483,128603,36,'submarines','Garrisonian','arches',''); +INSERT INTO t2 VALUES (484,128604,36,'mouthful','Strauss','Moll',''); +INSERT INTO t2 VALUES (485,128702,36,'expiring','cemented','ropers',''); +INSERT INTO t2 VALUES (486,128703,36,'unfulfilled','contrition','bombast',''); +INSERT INTO t2 VALUES (487,128704,36,'precession','mutations','difficultly','A'); +INSERT INTO t2 VALUES (488,138001,36,'nullified','exhibits','adsorption',''); +INSERT INTO t2 VALUES (489,138002,36,'affects','tits','definiteness','FAS'); +INSERT INTO t2 VALUES (490,138003,36,'Cynthia','mate','cultivation','A'); +INSERT INTO t2 VALUES (491,138004,36,'Chablis','arches','heals','A'); +INSERT INTO t2 VALUES (492,138005,36,'betterments','Moll','Heusen','W'); +INSERT INTO t2 VALUES (493,138006,36,'advertising','ropers','target','FAS'); +INSERT INTO t2 VALUES (494,138007,36,'rubies','bombast','cited','A'); +INSERT INTO t2 VALUES (495,138008,36,'southwest','difficultly','congresswoman','W'); +INSERT INTO t2 VALUES (496,138009,36,'superstitious','adsorption','Katherine',''); +INSERT INTO t2 VALUES (497,138102,36,'tabernacle','definiteness','titter','A'); +INSERT INTO t2 VALUES (498,138103,36,'silk','cultivation','aspire','A'); +INSERT INTO t2 VALUES (499,138104,36,'handsomest','heals','Mardis',''); +INSERT INTO t2 VALUES (500,138105,36,'Persian','Heusen','Nadia','W'); +INSERT INTO t2 VALUES (501,138201,36,'analog','target','estimating','FAS'); +INSERT INTO t2 VALUES (502,138302,36,'complex','cited','stuck','A'); +INSERT INTO t2 VALUES (503,138303,36,'Taoist','congresswoman','fifteenth','A'); +INSERT INTO t2 VALUES (504,138304,36,'suspend','Katherine','Colombo',''); +INSERT INTO t2 VALUES (505,138401,29,'relegated','titter','survey','A'); +INSERT INTO t2 VALUES (506,140102,29,'awesome','aspire','staffing',''); +INSERT INTO t2 VALUES (507,140103,29,'Bruxelles','Mardis','obtain',''); +INSERT INTO t2 VALUES (508,140104,29,'imprecisely','Nadia','loaded',''); +INSERT INTO t2 VALUES (509,140105,29,'televise','estimating','slaughtered',''); +INSERT INTO t2 VALUES (510,140201,29,'braking','stuck','lights','A'); +INSERT INTO t2 VALUES (511,140701,29,'true','fifteenth','circumference',''); +INSERT INTO t2 VALUES (512,141501,29,'disappointing','Colombo','dull','A'); +INSERT INTO t2 VALUES (513,141502,29,'navally','survey','weekly','A'); +INSERT INTO t2 VALUES (514,141901,29,'circus','staffing','wetness',''); +INSERT INTO t2 VALUES (515,141902,29,'beetles','obtain','visualized',''); +INSERT INTO t2 VALUES (516,142101,29,'trumps','loaded','Tannenbaum',''); +INSERT INTO t2 VALUES (517,142102,29,'fourscore','slaughtered','moribund',''); +INSERT INTO t2 VALUES (518,142103,29,'Blackfoots','lights','demultiplex',''); +INSERT INTO t2 VALUES (519,142701,29,'Grady','circumference','lockings',''); +INSERT INTO t2 VALUES (520,143001,29,'quiets','dull','thugs','FAS'); +INSERT INTO t2 VALUES (521,143501,29,'floundered','weekly','unnerves',''); +INSERT INTO t2 VALUES (522,143502,29,'profundity','wetness','abut',''); +INSERT INTO t2 VALUES (523,148001,29,'Garrisonian','visualized','Chippewa','A'); +INSERT INTO t2 VALUES (524,148002,29,'Strauss','Tannenbaum','stratifications','A'); +INSERT INTO t2 VALUES (525,148003,29,'cemented','moribund','signaled',''); +INSERT INTO t2 VALUES (526,148004,29,'contrition','demultiplex','Italianizes','A'); +INSERT INTO t2 VALUES (527,148005,29,'mutations','lockings','algorithmic','A'); +INSERT INTO t2 VALUES (528,148006,29,'exhibits','thugs','paranoid','FAS'); +INSERT INTO t2 VALUES (529,148007,29,'tits','unnerves','camping','A'); +INSERT INTO t2 VALUES (530,148009,29,'mate','abut','signifying','A'); +INSERT INTO t2 VALUES (531,148010,29,'arches','Chippewa','Patrice','W'); +INSERT INTO t2 VALUES (532,148011,29,'Moll','stratifications','search','A'); +INSERT INTO t2 VALUES (533,148012,29,'ropers','signaled','Angeles','A'); +INSERT INTO t2 VALUES (534,148013,29,'bombast','Italianizes','semblance',''); +INSERT INTO t2 VALUES (535,148023,36,'difficultly','algorithmic','taxed',''); +INSERT INTO t2 VALUES (536,148015,29,'adsorption','paranoid','Beatrice',''); +INSERT INTO t2 VALUES (537,148016,29,'definiteness','camping','retrace',''); +INSERT INTO t2 VALUES (538,148017,29,'cultivation','signifying','lockout',''); +INSERT INTO t2 VALUES (539,148018,29,'heals','Patrice','grammatic',''); +INSERT INTO t2 VALUES (540,148019,29,'Heusen','search','helmsman',''); +INSERT INTO t2 VALUES (541,148020,29,'target','Angeles','uniform','W'); +INSERT INTO t2 VALUES (542,148021,29,'cited','semblance','hamming',''); +INSERT INTO t2 VALUES (543,148022,29,'congresswoman','taxed','disobedience',''); +INSERT INTO t2 VALUES (544,148101,29,'Katherine','Beatrice','captivated','A'); +INSERT INTO t2 VALUES (545,148102,29,'titter','retrace','transferals','A'); +INSERT INTO t2 VALUES (546,148201,29,'aspire','lockout','cartographer','A'); +INSERT INTO t2 VALUES (547,148401,29,'Mardis','grammatic','aims','FAS'); +INSERT INTO t2 VALUES (548,148402,29,'Nadia','helmsman','Pakistani',''); +INSERT INTO t2 VALUES (549,148501,29,'estimating','uniform','burglarized','FAS'); +INSERT INTO t2 VALUES (550,148502,29,'stuck','hamming','saucepans','A'); +INSERT INTO t2 VALUES (551,148503,29,'fifteenth','disobedience','lacerating','A'); +INSERT INTO t2 VALUES (552,148504,29,'Colombo','captivated','corny',''); +INSERT INTO t2 VALUES (553,148601,29,'survey','transferals','megabytes','FAS'); +INSERT INTO t2 VALUES (554,148602,29,'staffing','cartographer','chancellor',''); +INSERT INTO t2 VALUES (555,150701,29,'obtain','aims','bulk','A'); +INSERT INTO t2 VALUES (556,152101,29,'loaded','Pakistani','commits','A'); +INSERT INTO t2 VALUES (557,152102,29,'slaughtered','burglarized','meson','W'); +INSERT INTO t2 VALUES (558,155202,36,'lights','saucepans','deputies',''); +INSERT INTO t2 VALUES (559,155203,29,'circumference','lacerating','northeaster','A'); +INSERT INTO t2 VALUES (560,155204,29,'dull','corny','dipole',''); +INSERT INTO t2 VALUES (561,155205,29,'weekly','megabytes','machining','0'); +INSERT INTO t2 VALUES (562,156001,29,'wetness','chancellor','therefore',''); +INSERT INTO t2 VALUES (563,156002,29,'visualized','bulk','Telefunken',''); +INSERT INTO t2 VALUES (564,156102,29,'Tannenbaum','commits','salvaging',''); +INSERT INTO t2 VALUES (565,156301,29,'moribund','meson','Corinthianizes','A'); +INSERT INTO t2 VALUES (566,156302,29,'demultiplex','deputies','restlessly','A'); +INSERT INTO t2 VALUES (567,156303,29,'lockings','northeaster','bromides',''); +INSERT INTO t2 VALUES (568,156304,29,'thugs','dipole','generalized','A'); +INSERT INTO t2 VALUES (569,156305,29,'unnerves','machining','mishaps',''); +INSERT INTO t2 VALUES (570,156306,29,'abut','therefore','quelling',''); +INSERT INTO t2 VALUES (571,156501,29,'Chippewa','Telefunken','spiritual','A'); +INSERT INTO t2 VALUES (572,158001,29,'stratifications','salvaging','beguiles','FAS'); +INSERT INTO t2 VALUES (573,158002,29,'signaled','Corinthianizes','Trobriand','FAS'); +INSERT INTO t2 VALUES (574,158101,29,'Italianizes','restlessly','fleeing','A'); +INSERT INTO t2 VALUES (575,158102,29,'algorithmic','bromides','Armour','A'); +INSERT INTO t2 VALUES (576,158103,29,'paranoid','generalized','chin','A'); +INSERT INTO t2 VALUES (577,158201,29,'camping','mishaps','provers','A'); +INSERT INTO t2 VALUES (578,158202,29,'signifying','quelling','aeronautic','A'); +INSERT INTO t2 VALUES (579,158203,29,'Patrice','spiritual','voltage','W'); +INSERT INTO t2 VALUES (580,158204,29,'search','beguiles','sash',''); +INSERT INTO t2 VALUES (581,158301,29,'Angeles','Trobriand','anaerobic','A'); +INSERT INTO t2 VALUES (582,158302,29,'semblance','fleeing','simultaneous','A'); +INSERT INTO t2 VALUES (583,158303,29,'taxed','Armour','accumulating','A'); +INSERT INTO t2 VALUES (584,158304,29,'Beatrice','chin','Medusan','A'); +INSERT INTO t2 VALUES (585,158305,29,'retrace','provers','shouted','A'); +INSERT INTO t2 VALUES (586,158306,29,'lockout','aeronautic','freakish',''); +INSERT INTO t2 VALUES (587,158501,29,'grammatic','voltage','index','FAS'); +INSERT INTO t2 VALUES (588,160301,29,'helmsman','sash','commercially',''); +INSERT INTO t2 VALUES (589,166101,50,'uniform','anaerobic','mistiness','A'); +INSERT INTO t2 VALUES (590,166102,50,'hamming','simultaneous','endpoint',''); +INSERT INTO t2 VALUES (591,168001,29,'disobedience','accumulating','straight','A'); +INSERT INTO t2 VALUES (592,168002,29,'captivated','Medusan','flurried',''); +INSERT INTO t2 VALUES (593,168003,29,'transferals','shouted','denotative','A'); +INSERT INTO t2 VALUES (594,168101,29,'cartographer','freakish','coming','FAS'); +INSERT INTO t2 VALUES (595,168102,29,'aims','index','commencements','FAS'); +INSERT INTO t2 VALUES (596,168103,29,'Pakistani','commercially','gentleman',''); +INSERT INTO t2 VALUES (597,168104,29,'burglarized','mistiness','gifted',''); +INSERT INTO t2 VALUES (598,168202,29,'saucepans','endpoint','Shanghais',''); +INSERT INTO t2 VALUES (599,168301,29,'lacerating','straight','sportswriting','A'); +INSERT INTO t2 VALUES (600,168502,29,'corny','flurried','sloping','A'); +INSERT INTO t2 VALUES (601,168503,29,'megabytes','denotative','navies',''); +INSERT INTO t2 VALUES (602,168601,29,'chancellor','coming','leaflet','A'); +INSERT INTO t2 VALUES (603,173001,40,'bulk','commencements','shooter',''); +INSERT INTO t2 VALUES (604,173701,40,'commits','gentleman','Joplin','FAS'); +INSERT INTO t2 VALUES (605,173702,40,'meson','gifted','babies',''); +INSERT INTO t2 VALUES (606,176001,40,'deputies','Shanghais','subdivision','FAS'); +INSERT INTO t2 VALUES (607,176101,40,'northeaster','sportswriting','burstiness','W'); +INSERT INTO t2 VALUES (608,176201,40,'dipole','sloping','belted','FAS'); +INSERT INTO t2 VALUES (609,176401,40,'machining','navies','assails','FAS'); +INSERT INTO t2 VALUES (610,176501,40,'therefore','leaflet','admiring','W'); +INSERT INTO t2 VALUES (611,176601,40,'Telefunken','shooter','swaying','0'); +INSERT INTO t2 VALUES (612,176602,40,'salvaging','Joplin','Goldstine','FAS'); +INSERT INTO t2 VALUES (613,176603,40,'Corinthianizes','babies','fitting',''); +INSERT INTO t2 VALUES (614,178001,40,'restlessly','subdivision','Norwalk','W'); +INSERT INTO t2 VALUES (615,178002,40,'bromides','burstiness','weakening','W'); +INSERT INTO t2 VALUES (616,178003,40,'generalized','belted','analogy','FAS'); +INSERT INTO t2 VALUES (617,178004,40,'mishaps','assails','deludes',''); +INSERT INTO t2 VALUES (618,178005,40,'quelling','admiring','cokes',''); +INSERT INTO t2 VALUES (619,178006,40,'spiritual','swaying','Clayton',''); +INSERT INTO t2 VALUES (620,178007,40,'beguiles','Goldstine','exhausts',''); +INSERT INTO t2 VALUES (621,178008,40,'Trobriand','fitting','causality',''); +INSERT INTO t2 VALUES (622,178101,40,'fleeing','Norwalk','sating','FAS'); +INSERT INTO t2 VALUES (623,178102,40,'Armour','weakening','icon',''); +INSERT INTO t2 VALUES (624,178103,40,'chin','analogy','throttles',''); +INSERT INTO t2 VALUES (625,178201,40,'provers','deludes','communicants','FAS'); +INSERT INTO t2 VALUES (626,178202,40,'aeronautic','cokes','dehydrate','FAS'); +INSERT INTO t2 VALUES (627,178301,40,'voltage','Clayton','priceless','FAS'); +INSERT INTO t2 VALUES (628,178302,40,'sash','exhausts','publicly',''); +INSERT INTO t2 VALUES (629,178401,40,'anaerobic','causality','incidentals','FAS'); +INSERT INTO t2 VALUES (630,178402,40,'simultaneous','sating','commonplace',''); +INSERT INTO t2 VALUES (631,178403,40,'accumulating','icon','mumbles',''); +INSERT INTO t2 VALUES (632,178404,40,'Medusan','throttles','furthermore','W'); +INSERT INTO t2 VALUES (633,178501,40,'shouted','communicants','cautioned','W'); +INSERT INTO t2 VALUES (634,186002,37,'freakish','dehydrate','parametrized','A'); +INSERT INTO t2 VALUES (635,186102,37,'index','priceless','registration','A'); +INSERT INTO t2 VALUES (636,186201,40,'commercially','publicly','sadly','FAS'); +INSERT INTO t2 VALUES (637,186202,40,'mistiness','incidentals','positioning',''); +INSERT INTO t2 VALUES (638,186203,40,'endpoint','commonplace','babysitting',''); +INSERT INTO t2 VALUES (639,186302,37,'straight','mumbles','eternal','A'); +INSERT INTO t2 VALUES (640,188007,37,'flurried','furthermore','hoarder',''); +INSERT INTO t2 VALUES (641,188008,37,'denotative','cautioned','congregates',''); +INSERT INTO t2 VALUES (642,188009,37,'coming','parametrized','rains',''); +INSERT INTO t2 VALUES (643,188010,37,'commencements','registration','workers','W'); +INSERT INTO t2 VALUES (644,188011,37,'gentleman','sadly','sags','A'); +INSERT INTO t2 VALUES (645,188012,37,'gifted','positioning','unplug','W'); +INSERT INTO t2 VALUES (646,188013,37,'Shanghais','babysitting','garage','A'); +INSERT INTO t2 VALUES (647,188014,37,'sportswriting','eternal','boulder','A'); +INSERT INTO t2 VALUES (648,188015,37,'sloping','hoarder','hollowly','A'); +INSERT INTO t2 VALUES (649,188016,37,'navies','congregates','specifics',''); +INSERT INTO t2 VALUES (650,188017,37,'leaflet','rains','Teresa',''); +INSERT INTO t2 VALUES (651,188102,37,'shooter','workers','Winsett',''); +INSERT INTO t2 VALUES (652,188103,37,'Joplin','sags','convenient','A'); +INSERT INTO t2 VALUES (653,188202,37,'babies','unplug','buckboards','FAS'); +INSERT INTO t2 VALUES (654,188301,40,'subdivision','garage','amenities',''); +INSERT INTO t2 VALUES (655,188302,40,'burstiness','boulder','resplendent','FAS'); +INSERT INTO t2 VALUES (656,188303,40,'belted','hollowly','priding','FAS'); +INSERT INTO t2 VALUES (657,188401,37,'assails','specifics','configurations',''); +INSERT INTO t2 VALUES (658,188402,37,'admiring','Teresa','untidiness','A'); +INSERT INTO t2 VALUES (659,188503,37,'swaying','Winsett','Brice','W'); +INSERT INTO t2 VALUES (660,188504,37,'Goldstine','convenient','sews','FAS'); +INSERT INTO t2 VALUES (661,188505,37,'fitting','buckboards','participated',''); +INSERT INTO t2 VALUES (662,190701,37,'Norwalk','amenities','Simon','FAS'); +INSERT INTO t2 VALUES (663,190703,50,'weakening','resplendent','certificates',''); +INSERT INTO t2 VALUES (664,191701,37,'analogy','priding','Fitzpatrick',''); +INSERT INTO t2 VALUES (665,191702,37,'deludes','configurations','Evanston','A'); +INSERT INTO t2 VALUES (666,191703,37,'cokes','untidiness','misted',''); +INSERT INTO t2 VALUES (667,196001,37,'Clayton','Brice','textures','A'); +INSERT INTO t2 VALUES (668,196002,37,'exhausts','sews','save',''); +INSERT INTO t2 VALUES (669,196003,37,'causality','participated','count',''); +INSERT INTO t2 VALUES (670,196101,37,'sating','Simon','rightful','A'); +INSERT INTO t2 VALUES (671,196103,37,'icon','certificates','chaperone',''); +INSERT INTO t2 VALUES (672,196104,37,'throttles','Fitzpatrick','Lizzy','A'); +INSERT INTO t2 VALUES (673,196201,37,'communicants','Evanston','clenched','A'); +INSERT INTO t2 VALUES (674,196202,37,'dehydrate','misted','effortlessly',''); +INSERT INTO t2 VALUES (675,196203,37,'priceless','textures','accessed',''); +INSERT INTO t2 VALUES (676,198001,37,'publicly','save','beaters','A'); +INSERT INTO t2 VALUES (677,198003,37,'incidentals','count','Hornblower','FAS'); +INSERT INTO t2 VALUES (678,198004,37,'commonplace','rightful','vests','A'); +INSERT INTO t2 VALUES (679,198005,37,'mumbles','chaperone','indulgences','FAS'); +INSERT INTO t2 VALUES (680,198006,37,'furthermore','Lizzy','infallibly','A'); +INSERT INTO t2 VALUES (681,198007,37,'cautioned','clenched','unwilling','FAS'); +INSERT INTO t2 VALUES (682,198008,37,'parametrized','effortlessly','excrete','FAS'); +INSERT INTO t2 VALUES (683,198009,37,'registration','accessed','spools','A'); +INSERT INTO t2 VALUES (684,198010,37,'sadly','beaters','crunches','FAS'); +INSERT INTO t2 VALUES (685,198011,37,'positioning','Hornblower','overestimating','FAS'); +INSERT INTO t2 VALUES (686,198012,37,'babysitting','vests','ineffective',''); +INSERT INTO t2 VALUES (687,198013,37,'eternal','indulgences','humiliation','A'); +INSERT INTO t2 VALUES (688,198014,37,'hoarder','infallibly','sophomore',''); +INSERT INTO t2 VALUES (689,198015,37,'congregates','unwilling','star',''); +INSERT INTO t2 VALUES (690,198017,37,'rains','excrete','rifles',''); +INSERT INTO t2 VALUES (691,198018,37,'workers','spools','dialysis',''); +INSERT INTO t2 VALUES (692,198019,37,'sags','crunches','arriving',''); +INSERT INTO t2 VALUES (693,198020,37,'unplug','overestimating','indulge',''); +INSERT INTO t2 VALUES (694,198021,37,'garage','ineffective','clockers',''); +INSERT INTO t2 VALUES (695,198022,37,'boulder','humiliation','languages',''); +INSERT INTO t2 VALUES (696,198023,50,'hollowly','sophomore','Antarctica','A'); +INSERT INTO t2 VALUES (697,198024,37,'specifics','star','percentage',''); +INSERT INTO t2 VALUES (698,198101,37,'Teresa','rifles','ceiling','A'); +INSERT INTO t2 VALUES (699,198103,37,'Winsett','dialysis','specification',''); +INSERT INTO t2 VALUES (700,198105,37,'convenient','arriving','regimented','A'); +INSERT INTO t2 VALUES (701,198106,37,'buckboards','indulge','ciphers',''); +INSERT INTO t2 VALUES (702,198201,37,'amenities','clockers','pictures','A'); +INSERT INTO t2 VALUES (703,198204,37,'resplendent','languages','serpents','A'); +INSERT INTO t2 VALUES (704,198301,53,'priding','Antarctica','allot','A'); +INSERT INTO t2 VALUES (705,198302,53,'configurations','percentage','realized','A'); +INSERT INTO t2 VALUES (706,198303,53,'untidiness','ceiling','mayoral','A'); +INSERT INTO t2 VALUES (707,198304,53,'Brice','specification','opaquely','A'); +INSERT INTO t2 VALUES (708,198401,37,'sews','regimented','hostess','FAS'); +INSERT INTO t2 VALUES (709,198402,37,'participated','ciphers','fiftieth',''); +INSERT INTO t2 VALUES (710,198403,37,'Simon','pictures','incorrectly',''); +INSERT INTO t2 VALUES (711,202101,37,'certificates','serpents','decomposition','FAS'); +INSERT INTO t2 VALUES (712,202301,37,'Fitzpatrick','allot','stranglings',''); +INSERT INTO t2 VALUES (713,202302,37,'Evanston','realized','mixture','FAS'); +INSERT INTO t2 VALUES (714,202303,37,'misted','mayoral','electroencephalography','FAS'); +INSERT INTO t2 VALUES (715,202304,37,'textures','opaquely','similarities','FAS'); +INSERT INTO t2 VALUES (716,202305,37,'save','hostess','charges','W'); +INSERT INTO t2 VALUES (717,202601,37,'count','fiftieth','freest','FAS'); +INSERT INTO t2 VALUES (718,202602,37,'rightful','incorrectly','Greenberg','FAS'); +INSERT INTO t2 VALUES (719,202605,37,'chaperone','decomposition','tinting',''); +INSERT INTO t2 VALUES (720,202606,37,'Lizzy','stranglings','expelled','W'); +INSERT INTO t2 VALUES (721,202607,37,'clenched','mixture','warm',''); +INSERT INTO t2 VALUES (722,202901,37,'effortlessly','electroencephalography','smoothed',''); +INSERT INTO t2 VALUES (723,202902,37,'accessed','similarities','deductions','FAS'); +INSERT INTO t2 VALUES (724,202903,37,'beaters','charges','Romano','W'); +INSERT INTO t2 VALUES (725,202904,37,'Hornblower','freest','bitterroot',''); +INSERT INTO t2 VALUES (726,202907,37,'vests','Greenberg','corset',''); +INSERT INTO t2 VALUES (727,202908,37,'indulgences','tinting','securing',''); +INSERT INTO t2 VALUES (728,203101,37,'infallibly','expelled','environing','FAS'); +INSERT INTO t2 VALUES (729,203103,37,'unwilling','warm','cute',''); +INSERT INTO t2 VALUES (730,203104,37,'excrete','smoothed','Crays',''); +INSERT INTO t2 VALUES (731,203105,37,'spools','deductions','heiress','FAS'); +INSERT INTO t2 VALUES (732,203401,37,'crunches','Romano','inform','FAS'); +INSERT INTO t2 VALUES (733,203402,37,'overestimating','bitterroot','avenge',''); +INSERT INTO t2 VALUES (734,203404,37,'ineffective','corset','universals',''); +INSERT INTO t2 VALUES (735,203901,37,'humiliation','securing','Kinsey','W'); +INSERT INTO t2 VALUES (736,203902,37,'sophomore','environing','ravines','FAS'); +INSERT INTO t2 VALUES (737,203903,37,'star','cute','bestseller',''); +INSERT INTO t2 VALUES (738,203906,37,'rifles','Crays','equilibrium',''); +INSERT INTO t2 VALUES (739,203907,37,'dialysis','heiress','extents','0'); +INSERT INTO t2 VALUES (740,203908,37,'arriving','inform','relatively',''); +INSERT INTO t2 VALUES (741,203909,37,'indulge','avenge','pressure','FAS'); +INSERT INTO t2 VALUES (742,206101,37,'clockers','universals','critiques','FAS'); +INSERT INTO t2 VALUES (743,206201,37,'languages','Kinsey','befouled',''); +INSERT INTO t2 VALUES (744,206202,37,'Antarctica','ravines','rightfully','FAS'); +INSERT INTO t2 VALUES (745,206203,37,'percentage','bestseller','mechanizing','FAS'); +INSERT INTO t2 VALUES (746,206206,37,'ceiling','equilibrium','Latinizes',''); +INSERT INTO t2 VALUES (747,206207,37,'specification','extents','timesharing',''); +INSERT INTO t2 VALUES (748,206208,37,'regimented','relatively','Aden',''); +INSERT INTO t2 VALUES (749,208001,37,'ciphers','pressure','embassies',''); +INSERT INTO t2 VALUES (750,208002,37,'pictures','critiques','males','FAS'); +INSERT INTO t2 VALUES (751,208003,37,'serpents','befouled','shapelessly','FAS'); +INSERT INTO t2 VALUES (752,208004,37,'allot','rightfully','genres','FAS'); +INSERT INTO t2 VALUES (753,208008,37,'realized','mechanizing','mastering',''); +INSERT INTO t2 VALUES (754,208009,37,'mayoral','Latinizes','Newtonian',''); +INSERT INTO t2 VALUES (755,208010,37,'opaquely','timesharing','finishers','FAS'); +INSERT INTO t2 VALUES (756,208011,37,'hostess','Aden','abates',''); +INSERT INTO t2 VALUES (757,208101,37,'fiftieth','embassies','teem',''); +INSERT INTO t2 VALUES (758,208102,37,'incorrectly','males','kiting','FAS'); +INSERT INTO t2 VALUES (759,208103,37,'decomposition','shapelessly','stodgy','FAS'); +INSERT INTO t2 VALUES (760,208104,37,'stranglings','genres','scalps','FAS'); +INSERT INTO t2 VALUES (761,208105,37,'mixture','mastering','feed','FAS'); +INSERT INTO t2 VALUES (762,208110,37,'electroencephalography','Newtonian','guitars',''); +INSERT INTO t2 VALUES (763,208111,37,'similarities','finishers','airships',''); +INSERT INTO t2 VALUES (764,208112,37,'charges','abates','store',''); +INSERT INTO t2 VALUES (765,208113,37,'freest','teem','denounces',''); +INSERT INTO t2 VALUES (766,208201,37,'Greenberg','kiting','Pyle','FAS'); +INSERT INTO t2 VALUES (767,208203,37,'tinting','stodgy','Saxony',''); +INSERT INTO t2 VALUES (768,208301,37,'expelled','scalps','serializations','FAS'); +INSERT INTO t2 VALUES (769,208302,37,'warm','feed','Peruvian','FAS'); +INSERT INTO t2 VALUES (770,208305,37,'smoothed','guitars','taxonomically','FAS'); +INSERT INTO t2 VALUES (771,208401,37,'deductions','airships','kingdom','A'); +INSERT INTO t2 VALUES (772,208402,37,'Romano','store','stint','A'); +INSERT INTO t2 VALUES (773,208403,37,'bitterroot','denounces','Sault','A'); +INSERT INTO t2 VALUES (774,208404,37,'corset','Pyle','faithful',''); +INSERT INTO t2 VALUES (775,208501,37,'securing','Saxony','Ganymede','FAS'); +INSERT INTO t2 VALUES (776,208502,37,'environing','serializations','tidiness','FAS'); +INSERT INTO t2 VALUES (777,208503,37,'cute','Peruvian','gainful','FAS'); +INSERT INTO t2 VALUES (778,208504,37,'Crays','taxonomically','contrary','FAS'); +INSERT INTO t2 VALUES (779,208505,37,'heiress','kingdom','Tipperary','FAS'); +INSERT INTO t2 VALUES (780,210101,37,'inform','stint','tropics','W'); +INSERT INTO t2 VALUES (781,210102,37,'avenge','Sault','theorizers',''); +INSERT INTO t2 VALUES (782,210103,37,'universals','faithful','renew','0'); +INSERT INTO t2 VALUES (783,210104,37,'Kinsey','Ganymede','already',''); +INSERT INTO t2 VALUES (784,210105,37,'ravines','tidiness','terminal',''); +INSERT INTO t2 VALUES (785,210106,37,'bestseller','gainful','Hegelian',''); +INSERT INTO t2 VALUES (786,210107,37,'equilibrium','contrary','hypothesizer',''); +INSERT INTO t2 VALUES (787,210401,37,'extents','Tipperary','warningly','FAS'); +INSERT INTO t2 VALUES (788,213201,37,'relatively','tropics','journalizing','FAS'); +INSERT INTO t2 VALUES (789,213203,37,'pressure','theorizers','nested',''); +INSERT INTO t2 VALUES (790,213204,37,'critiques','renew','Lars',''); +INSERT INTO t2 VALUES (791,213205,37,'befouled','already','saplings',''); +INSERT INTO t2 VALUES (792,213206,37,'rightfully','terminal','foothill',''); +INSERT INTO t2 VALUES (793,213207,37,'mechanizing','Hegelian','labeled',''); +INSERT INTO t2 VALUES (794,216101,37,'Latinizes','hypothesizer','imperiously','FAS'); +INSERT INTO t2 VALUES (795,216103,37,'timesharing','warningly','reporters','FAS'); +INSERT INTO t2 VALUES (796,218001,37,'Aden','journalizing','furnishings','FAS'); +INSERT INTO t2 VALUES (797,218002,37,'embassies','nested','precipitable','FAS'); +INSERT INTO t2 VALUES (798,218003,37,'males','Lars','discounts','FAS'); +INSERT INTO t2 VALUES (799,218004,37,'shapelessly','saplings','excises','FAS'); +INSERT INTO t2 VALUES (800,143503,50,'genres','foothill','Stalin',''); +INSERT INTO t2 VALUES (801,218006,37,'mastering','labeled','despot','FAS'); +INSERT INTO t2 VALUES (802,218007,37,'Newtonian','imperiously','ripeness','FAS'); +INSERT INTO t2 VALUES (803,218008,37,'finishers','reporters','Arabia',''); +INSERT INTO t2 VALUES (804,218009,37,'abates','furnishings','unruly',''); +INSERT INTO t2 VALUES (805,218010,37,'teem','precipitable','mournfulness',''); +INSERT INTO t2 VALUES (806,218011,37,'kiting','discounts','boom','FAS'); +INSERT INTO t2 VALUES (807,218020,37,'stodgy','excises','slaughter','A'); +INSERT INTO t2 VALUES (808,218021,50,'scalps','Stalin','Sabine',''); +INSERT INTO t2 VALUES (809,218022,37,'feed','despot','handy','FAS'); +INSERT INTO t2 VALUES (810,218023,37,'guitars','ripeness','rural',''); +INSERT INTO t2 VALUES (811,218024,37,'airships','Arabia','organizer',''); +INSERT INTO t2 VALUES (812,218101,37,'store','unruly','shipyard','FAS'); +INSERT INTO t2 VALUES (813,218102,37,'denounces','mournfulness','civics','FAS'); +INSERT INTO t2 VALUES (814,218103,37,'Pyle','boom','inaccuracy','FAS'); +INSERT INTO t2 VALUES (815,218201,37,'Saxony','slaughter','rules','FAS'); +INSERT INTO t2 VALUES (816,218202,37,'serializations','Sabine','juveniles','FAS'); +INSERT INTO t2 VALUES (817,218203,37,'Peruvian','handy','comprised','W'); +INSERT INTO t2 VALUES (818,218204,37,'taxonomically','rural','investigations',''); +INSERT INTO t2 VALUES (819,218205,37,'kingdom','organizer','stabilizes','A'); +INSERT INTO t2 VALUES (820,218301,37,'stint','shipyard','seminaries','FAS'); +INSERT INTO t2 VALUES (821,218302,37,'Sault','civics','Hunter','A'); +INSERT INTO t2 VALUES (822,218401,37,'faithful','inaccuracy','sporty','FAS'); +INSERT INTO t2 VALUES (823,218402,37,'Ganymede','rules','test','FAS'); +INSERT INTO t2 VALUES (824,218403,37,'tidiness','juveniles','weasels',''); +INSERT INTO t2 VALUES (825,218404,37,'gainful','comprised','CERN',''); +INSERT INTO t2 VALUES (826,218407,37,'contrary','investigations','tempering',''); +INSERT INTO t2 VALUES (827,218408,37,'Tipperary','stabilizes','afore','FAS'); +INSERT INTO t2 VALUES (828,218409,37,'tropics','seminaries','Galatean',''); +INSERT INTO t2 VALUES (829,218410,37,'theorizers','Hunter','techniques','W'); +INSERT INTO t2 VALUES (830,226001,37,'renew','sporty','error',''); +INSERT INTO t2 VALUES (831,226002,37,'already','test','veranda',''); +INSERT INTO t2 VALUES (832,226003,37,'terminal','weasels','severely',''); +INSERT INTO t2 VALUES (833,226004,37,'Hegelian','CERN','Cassites','FAS'); +INSERT INTO t2 VALUES (834,226005,37,'hypothesizer','tempering','forthcoming',''); +INSERT INTO t2 VALUES (835,226006,37,'warningly','afore','guides',''); +INSERT INTO t2 VALUES (836,226007,37,'journalizing','Galatean','vanish','FAS'); +INSERT INTO t2 VALUES (837,226008,37,'nested','techniques','lied','A'); +INSERT INTO t2 VALUES (838,226203,37,'Lars','error','sawtooth','FAS'); +INSERT INTO t2 VALUES (839,226204,37,'saplings','veranda','fated','FAS'); +INSERT INTO t2 VALUES (840,226205,37,'foothill','severely','gradually',''); +INSERT INTO t2 VALUES (841,226206,37,'labeled','Cassites','widens',''); +INSERT INTO t2 VALUES (842,226207,37,'imperiously','forthcoming','preclude',''); +INSERT INTO t2 VALUES (843,226208,37,'reporters','guides','Jobrel',''); +INSERT INTO t2 VALUES (844,226209,37,'furnishings','vanish','hooker',''); +INSERT INTO t2 VALUES (845,226210,37,'precipitable','lied','rainstorm',''); +INSERT INTO t2 VALUES (846,226211,37,'discounts','sawtooth','disconnects',''); +INSERT INTO t2 VALUES (847,228001,37,'excises','fated','cruelty',''); +INSERT INTO t2 VALUES (848,228004,37,'Stalin','gradually','exponentials','A'); +INSERT INTO t2 VALUES (849,228005,37,'despot','widens','affective','A'); +INSERT INTO t2 VALUES (850,228006,37,'ripeness','preclude','arteries',''); +INSERT INTO t2 VALUES (851,228007,37,'Arabia','Jobrel','Crosby','FAS'); +INSERT INTO t2 VALUES (852,228008,37,'unruly','hooker','acquaint',''); +INSERT INTO t2 VALUES (853,228009,37,'mournfulness','rainstorm','evenhandedly',''); +INSERT INTO t2 VALUES (854,228101,37,'boom','disconnects','percentage',''); +INSERT INTO t2 VALUES (855,228108,37,'slaughter','cruelty','disobedience',''); +INSERT INTO t2 VALUES (856,228109,37,'Sabine','exponentials','humility',''); +INSERT INTO t2 VALUES (857,228110,37,'handy','affective','gleaning','A'); +INSERT INTO t2 VALUES (858,228111,37,'rural','arteries','petted','A'); +INSERT INTO t2 VALUES (859,228112,37,'organizer','Crosby','bloater','A'); +INSERT INTO t2 VALUES (860,228113,37,'shipyard','acquaint','minion','A'); +INSERT INTO t2 VALUES (861,228114,37,'civics','evenhandedly','marginal','A'); +INSERT INTO t2 VALUES (862,228115,37,'inaccuracy','percentage','apiary','A'); +INSERT INTO t2 VALUES (863,228116,37,'rules','disobedience','measures',''); +INSERT INTO t2 VALUES (864,228117,37,'juveniles','humility','precaution',''); +INSERT INTO t2 VALUES (865,228118,37,'comprised','gleaning','repelled',''); +INSERT INTO t2 VALUES (866,228119,37,'investigations','petted','primary','FAS'); +INSERT INTO t2 VALUES (867,228120,37,'stabilizes','bloater','coverings',''); +INSERT INTO t2 VALUES (868,228121,37,'seminaries','minion','Artemia','A'); +INSERT INTO t2 VALUES (869,228122,37,'Hunter','marginal','navigate',''); +INSERT INTO t2 VALUES (870,228201,37,'sporty','apiary','spatial',''); +INSERT INTO t2 VALUES (871,228206,37,'test','measures','Gurkha',''); +INSERT INTO t2 VALUES (872,228207,37,'weasels','precaution','meanwhile','A'); +INSERT INTO t2 VALUES (873,228208,37,'CERN','repelled','Melinda','A'); +INSERT INTO t2 VALUES (874,228209,37,'tempering','primary','Butterfield',''); +INSERT INTO t2 VALUES (875,228210,37,'afore','coverings','Aldrich','A'); +INSERT INTO t2 VALUES (876,228211,37,'Galatean','Artemia','previewing','A'); +INSERT INTO t2 VALUES (877,228212,37,'techniques','navigate','glut','A'); +INSERT INTO t2 VALUES (878,228213,37,'error','spatial','unaffected',''); +INSERT INTO t2 VALUES (879,228214,37,'veranda','Gurkha','inmate',''); +INSERT INTO t2 VALUES (880,228301,37,'severely','meanwhile','mineral',''); +INSERT INTO t2 VALUES (881,228305,37,'Cassites','Melinda','impending','A'); +INSERT INTO t2 VALUES (882,228306,37,'forthcoming','Butterfield','meditation','A'); +INSERT INTO t2 VALUES (883,228307,37,'guides','Aldrich','ideas',''); +INSERT INTO t2 VALUES (884,228308,37,'vanish','previewing','miniaturizes','W'); +INSERT INTO t2 VALUES (885,228309,37,'lied','glut','lewdly',''); +INSERT INTO t2 VALUES (886,228310,37,'sawtooth','unaffected','title',''); +INSERT INTO t2 VALUES (887,228311,37,'fated','inmate','youthfulness',''); +INSERT INTO t2 VALUES (888,228312,37,'gradually','mineral','creak','FAS'); +INSERT INTO t2 VALUES (889,228313,37,'widens','impending','Chippewa',''); +INSERT INTO t2 VALUES (890,228314,37,'preclude','meditation','clamored',''); +INSERT INTO t2 VALUES (891,228401,65,'Jobrel','ideas','freezes',''); +INSERT INTO t2 VALUES (892,228402,65,'hooker','miniaturizes','forgivably','FAS'); +INSERT INTO t2 VALUES (893,228403,65,'rainstorm','lewdly','reduce','FAS'); +INSERT INTO t2 VALUES (894,228404,65,'disconnects','title','McGovern','W'); +INSERT INTO t2 VALUES (895,228405,65,'cruelty','youthfulness','Nazis','W'); +INSERT INTO t2 VALUES (896,228406,65,'exponentials','creak','epistle','W'); +INSERT INTO t2 VALUES (897,228407,65,'affective','Chippewa','socializes','W'); +INSERT INTO t2 VALUES (898,228408,65,'arteries','clamored','conceptions',''); +INSERT INTO t2 VALUES (899,228409,65,'Crosby','freezes','Kevin',''); +INSERT INTO t2 VALUES (900,228410,65,'acquaint','forgivably','uncovering',''); +INSERT INTO t2 VALUES (901,230301,37,'evenhandedly','reduce','chews','FAS'); +INSERT INTO t2 VALUES (902,230302,37,'percentage','McGovern','appendixes','FAS'); +INSERT INTO t2 VALUES (903,230303,37,'disobedience','Nazis','raining',''); +INSERT INTO t2 VALUES (904,018062,37,'humility','epistle','infest',''); +INSERT INTO t2 VALUES (905,230501,37,'gleaning','socializes','compartment',''); +INSERT INTO t2 VALUES (906,230502,37,'petted','conceptions','minting',''); +INSERT INTO t2 VALUES (907,230503,37,'bloater','Kevin','ducks',''); +INSERT INTO t2 VALUES (908,230504,37,'minion','uncovering','roped','A'); +INSERT INTO t2 VALUES (909,230505,37,'marginal','chews','waltz',''); +INSERT INTO t2 VALUES (910,230506,37,'apiary','appendixes','Lillian',''); +INSERT INTO t2 VALUES (911,230507,37,'measures','raining','repressions','A'); +INSERT INTO t2 VALUES (912,230508,37,'precaution','infest','chillingly',''); +INSERT INTO t2 VALUES (913,230509,37,'repelled','compartment','noncritical',''); +INSERT INTO t2 VALUES (914,230901,37,'primary','minting','lithograph',''); +INSERT INTO t2 VALUES (915,230902,37,'coverings','ducks','spongers',''); +INSERT INTO t2 VALUES (916,230903,37,'Artemia','roped','parenthood',''); +INSERT INTO t2 VALUES (917,230904,37,'navigate','waltz','posed',''); +INSERT INTO t2 VALUES (918,230905,37,'spatial','Lillian','instruments',''); +INSERT INTO t2 VALUES (919,230906,37,'Gurkha','repressions','filial',''); +INSERT INTO t2 VALUES (920,230907,37,'meanwhile','chillingly','fixedly',''); +INSERT INTO t2 VALUES (921,230908,37,'Melinda','noncritical','relives',''); +INSERT INTO t2 VALUES (922,230909,37,'Butterfield','lithograph','Pandora',''); +INSERT INTO t2 VALUES (923,230910,37,'Aldrich','spongers','watering','A'); +INSERT INTO t2 VALUES (924,230911,37,'previewing','parenthood','ungrateful',''); +INSERT INTO t2 VALUES (925,230912,37,'glut','posed','secures',''); +INSERT INTO t2 VALUES (926,230913,37,'unaffected','instruments','chastisers',''); +INSERT INTO t2 VALUES (927,230914,37,'inmate','filial','icon',''); +INSERT INTO t2 VALUES (928,231304,37,'mineral','fixedly','reuniting','A'); +INSERT INTO t2 VALUES (929,231305,37,'impending','relives','imagining','A'); +INSERT INTO t2 VALUES (930,231306,37,'meditation','Pandora','abiding','A'); +INSERT INTO t2 VALUES (931,231307,37,'ideas','watering','omnisciently',''); +INSERT INTO t2 VALUES (932,231308,37,'miniaturizes','ungrateful','Britannic',''); +INSERT INTO t2 VALUES (933,231309,37,'lewdly','secures','scholastics','A'); +INSERT INTO t2 VALUES (934,231310,37,'title','chastisers','mechanics','A'); +INSERT INTO t2 VALUES (935,231311,37,'youthfulness','icon','humidly','A'); +INSERT INTO t2 VALUES (936,231312,37,'creak','reuniting','masterpiece',''); +INSERT INTO t2 VALUES (937,231313,37,'Chippewa','imagining','however',''); +INSERT INTO t2 VALUES (938,231314,37,'clamored','abiding','Mendelian',''); +INSERT INTO t2 VALUES (939,231315,37,'freezes','omnisciently','jarred',''); +INSERT INTO t2 VALUES (940,232102,37,'forgivably','Britannic','scolds',''); +INSERT INTO t2 VALUES (941,232103,37,'reduce','scholastics','infatuate',''); +INSERT INTO t2 VALUES (942,232104,37,'McGovern','mechanics','willed','A'); +INSERT INTO t2 VALUES (943,232105,37,'Nazis','humidly','joyfully',''); +INSERT INTO t2 VALUES (944,232106,37,'epistle','masterpiece','Microsoft',''); +INSERT INTO t2 VALUES (945,232107,37,'socializes','however','fibrosities',''); +INSERT INTO t2 VALUES (946,232108,37,'conceptions','Mendelian','Baltimorean',''); +INSERT INTO t2 VALUES (947,232601,37,'Kevin','jarred','equestrian',''); +INSERT INTO t2 VALUES (948,232602,37,'uncovering','scolds','Goodrich',''); +INSERT INTO t2 VALUES (949,232603,37,'chews','infatuate','apish','A'); +INSERT INTO t2 VALUES (950,232605,37,'appendixes','willed','Adlerian',''); +INSERT INTO t2 VALUES (5950,1232605,37,'appendixes','willed','Adlerian',''); +INSERT INTO t2 VALUES (5951,1232606,37,'appendixes','willed','Adlerian',''); +INSERT INTO t2 VALUES (5952,1232607,37,'appendixes','willed','Adlerian',''); +INSERT INTO t2 VALUES (5953,1232608,37,'appendixes','willed','Adlerian',''); +INSERT INTO t2 VALUES (5954,1232609,37,'appendixes','willed','Adlerian',''); +INSERT INTO t2 VALUES (951,232606,37,'raining','joyfully','Tropez',''); +INSERT INTO t2 VALUES (952,232607,37,'infest','Microsoft','nouns',''); +INSERT INTO t2 VALUES (953,232608,37,'compartment','fibrosities','distracting',''); +INSERT INTO t2 VALUES (954,232609,37,'minting','Baltimorean','mutton',''); +INSERT INTO t2 VALUES (955,236104,37,'ducks','equestrian','bridgeable','A'); +INSERT INTO t2 VALUES (956,236105,37,'roped','Goodrich','stickers','A'); +INSERT INTO t2 VALUES (957,236106,37,'waltz','apish','transcontinental','A'); +INSERT INTO t2 VALUES (958,236107,37,'Lillian','Adlerian','amateurish',''); +INSERT INTO t2 VALUES (959,236108,37,'repressions','Tropez','Gandhian',''); +INSERT INTO t2 VALUES (960,236109,37,'chillingly','nouns','stratified',''); +INSERT INTO t2 VALUES (961,236110,37,'noncritical','distracting','chamberlains',''); +INSERT INTO t2 VALUES (962,236111,37,'lithograph','mutton','creditably',''); +INSERT INTO t2 VALUES (963,236112,37,'spongers','bridgeable','philosophic',''); +INSERT INTO t2 VALUES (964,236113,37,'parenthood','stickers','ores',''); +INSERT INTO t2 VALUES (965,238005,37,'posed','transcontinental','Carleton',''); +INSERT INTO t2 VALUES (966,238006,37,'instruments','amateurish','tape','A'); +INSERT INTO t2 VALUES (967,238007,37,'filial','Gandhian','afloat','A'); +INSERT INTO t2 VALUES (968,238008,37,'fixedly','stratified','goodness','A'); +INSERT INTO t2 VALUES (969,238009,37,'relives','chamberlains','welcoming',''); +INSERT INTO t2 VALUES (970,238010,37,'Pandora','creditably','Pinsky','FAS'); +INSERT INTO t2 VALUES (971,238011,37,'watering','philosophic','halting',''); +INSERT INTO t2 VALUES (972,238012,37,'ungrateful','ores','bibliography',''); +INSERT INTO t2 VALUES (973,238013,37,'secures','Carleton','decoding',''); +INSERT INTO t2 VALUES (974,240401,41,'chastisers','tape','variance','A'); +INSERT INTO t2 VALUES (975,240402,41,'icon','afloat','allowed','A'); +INSERT INTO t2 VALUES (976,240901,41,'reuniting','goodness','dire','A'); +INSERT INTO t2 VALUES (977,240902,41,'imagining','welcoming','dub','A'); +INSERT INTO t2 VALUES (978,241801,41,'abiding','Pinsky','poisoning',''); +INSERT INTO t2 VALUES (979,242101,41,'omnisciently','halting','Iraqis','A'); +INSERT INTO t2 VALUES (980,242102,41,'Britannic','bibliography','heaving',''); +INSERT INTO t2 VALUES (981,242201,41,'scholastics','decoding','population','A'); +INSERT INTO t2 VALUES (982,242202,41,'mechanics','variance','bomb','A'); +INSERT INTO t2 VALUES (983,242501,41,'humidly','allowed','Majorca','A'); +INSERT INTO t2 VALUES (984,242502,41,'masterpiece','dire','Gershwins',''); +INSERT INTO t2 VALUES (985,246201,41,'however','dub','explorers',''); +INSERT INTO t2 VALUES (986,246202,41,'Mendelian','poisoning','libretto','A'); +INSERT INTO t2 VALUES (987,246203,41,'jarred','Iraqis','occurred',''); +INSERT INTO t2 VALUES (988,246204,41,'scolds','heaving','Lagos',''); +INSERT INTO t2 VALUES (989,246205,41,'infatuate','population','rats',''); +INSERT INTO t2 VALUES (990,246301,41,'willed','bomb','bankruptcies','A'); +INSERT INTO t2 VALUES (991,246302,41,'joyfully','Majorca','crying',''); +INSERT INTO t2 VALUES (992,248001,41,'Microsoft','Gershwins','unexpected',''); +INSERT INTO t2 VALUES (993,248002,41,'fibrosities','explorers','accessed','A'); +INSERT INTO t2 VALUES (994,248003,41,'Baltimorean','libretto','colorful','A'); +INSERT INTO t2 VALUES (995,248004,41,'equestrian','occurred','versatility','A'); +INSERT INTO t2 VALUES (996,248005,41,'Goodrich','Lagos','cosy',''); +INSERT INTO t2 VALUES (997,248006,41,'apish','rats','Darius','A'); +INSERT INTO t2 VALUES (998,248007,41,'Adlerian','bankruptcies','mastering','A'); +INSERT INTO t2 VALUES (999,248008,41,'Tropez','crying','Asiaticizations','A'); +INSERT INTO t2 VALUES (1000,248009,41,'nouns','unexpected','offerers','A'); +INSERT INTO t2 VALUES (1001,248010,41,'distracting','accessed','uncles','A'); +INSERT INTO t2 VALUES (1002,248011,41,'mutton','colorful','sleepwalk',''); +INSERT INTO t2 VALUES (1003,248012,41,'bridgeable','versatility','Ernestine',''); +INSERT INTO t2 VALUES (1004,248013,41,'stickers','cosy','checksumming',''); +INSERT INTO t2 VALUES (1005,248014,41,'transcontinental','Darius','stopped',''); +INSERT INTO t2 VALUES (1006,248015,41,'amateurish','mastering','sicker',''); +INSERT INTO t2 VALUES (1007,248016,41,'Gandhian','Asiaticizations','Italianization',''); +INSERT INTO t2 VALUES (1008,248017,41,'stratified','offerers','alphabetic',''); +INSERT INTO t2 VALUES (1009,248018,41,'chamberlains','uncles','pharmaceutic',''); +INSERT INTO t2 VALUES (1010,248019,41,'creditably','sleepwalk','creator',''); +INSERT INTO t2 VALUES (1011,248020,41,'philosophic','Ernestine','chess',''); +INSERT INTO t2 VALUES (1012,248021,41,'ores','checksumming','charcoal',''); +INSERT INTO t2 VALUES (1013,248101,41,'Carleton','stopped','Epiphany','A'); +INSERT INTO t2 VALUES (1014,248102,41,'tape','sicker','bulldozes','A'); +INSERT INTO t2 VALUES (1015,248201,41,'afloat','Italianization','Pygmalion','A'); +INSERT INTO t2 VALUES (1016,248202,41,'goodness','alphabetic','caressing','A'); +INSERT INTO t2 VALUES (1017,248203,41,'welcoming','pharmaceutic','Palestine','A'); +INSERT INTO t2 VALUES (1018,248204,41,'Pinsky','creator','regimented','A'); +INSERT INTO t2 VALUES (1019,248205,41,'halting','chess','scars','A'); +INSERT INTO t2 VALUES (1020,248206,41,'bibliography','charcoal','realest','A'); +INSERT INTO t2 VALUES (1021,248207,41,'decoding','Epiphany','diffusing','A'); +INSERT INTO t2 VALUES (1022,248208,41,'variance','bulldozes','clubroom','A'); +INSERT INTO t2 VALUES (1023,248209,41,'allowed','Pygmalion','Blythe','A'); +INSERT INTO t2 VALUES (1024,248210,41,'dire','caressing','ahead',''); +INSERT INTO t2 VALUES (1025,248211,50,'dub','Palestine','reviver',''); +INSERT INTO t2 VALUES (1026,250501,34,'poisoning','regimented','retransmitting','A'); +INSERT INTO t2 VALUES (1027,250502,34,'Iraqis','scars','landslide',''); +INSERT INTO t2 VALUES (1028,250503,34,'heaving','realest','Eiffel',''); +INSERT INTO t2 VALUES (1029,250504,34,'population','diffusing','absentee',''); +INSERT INTO t2 VALUES (1030,250505,34,'bomb','clubroom','aye',''); +INSERT INTO t2 VALUES (1031,250601,34,'Majorca','Blythe','forked','A'); +INSERT INTO t2 VALUES (1032,250602,34,'Gershwins','ahead','Peruvianizes',''); +INSERT INTO t2 VALUES (1033,250603,34,'explorers','reviver','clerked',''); +INSERT INTO t2 VALUES (1034,250604,34,'libretto','retransmitting','tutor',''); +INSERT INTO t2 VALUES (1035,250605,34,'occurred','landslide','boulevard',''); +INSERT INTO t2 VALUES (1036,251001,34,'Lagos','Eiffel','shuttered',''); +INSERT INTO t2 VALUES (1037,251002,34,'rats','absentee','quotes','A'); +INSERT INTO t2 VALUES (1038,251003,34,'bankruptcies','aye','Caltech',''); +INSERT INTO t2 VALUES (1039,251004,34,'crying','forked','Mossberg',''); +INSERT INTO t2 VALUES (1040,251005,34,'unexpected','Peruvianizes','kept',''); +INSERT INTO t2 VALUES (1041,251301,34,'accessed','clerked','roundly',''); +INSERT INTO t2 VALUES (1042,251302,34,'colorful','tutor','features','A'); +INSERT INTO t2 VALUES (1043,251303,34,'versatility','boulevard','imaginable','A'); +INSERT INTO t2 VALUES (1044,251304,34,'cosy','shuttered','controller',''); +INSERT INTO t2 VALUES (1045,251305,34,'Darius','quotes','racial',''); +INSERT INTO t2 VALUES (1046,251401,34,'mastering','Caltech','uprisings','A'); +INSERT INTO t2 VALUES (1047,251402,34,'Asiaticizations','Mossberg','narrowed','A'); +INSERT INTO t2 VALUES (1048,251403,34,'offerers','kept','cannot','A'); +INSERT INTO t2 VALUES (1049,251404,34,'uncles','roundly','vest',''); +INSERT INTO t2 VALUES (1050,251405,34,'sleepwalk','features','famine',''); +INSERT INTO t2 VALUES (1051,251406,34,'Ernestine','imaginable','sugars',''); +INSERT INTO t2 VALUES (1052,251801,34,'checksumming','controller','exterminated','A'); +INSERT INTO t2 VALUES (1053,251802,34,'stopped','racial','belays',''); +INSERT INTO t2 VALUES (1054,252101,34,'sicker','uprisings','Hodges','A'); +INSERT INTO t2 VALUES (1055,252102,34,'Italianization','narrowed','translatable',''); +INSERT INTO t2 VALUES (1056,252301,34,'alphabetic','cannot','duality','A'); +INSERT INTO t2 VALUES (1057,252302,34,'pharmaceutic','vest','recording','A'); +INSERT INTO t2 VALUES (1058,252303,34,'creator','famine','rouses','A'); +INSERT INTO t2 VALUES (1059,252304,34,'chess','sugars','poison',''); +INSERT INTO t2 VALUES (1060,252305,34,'charcoal','exterminated','attitude',''); +INSERT INTO t2 VALUES (1061,252306,34,'Epiphany','belays','dusted',''); +INSERT INTO t2 VALUES (1062,252307,34,'bulldozes','Hodges','encompasses',''); +INSERT INTO t2 VALUES (1063,252308,34,'Pygmalion','translatable','presentation',''); +INSERT INTO t2 VALUES (1064,252309,34,'caressing','duality','Kantian',''); +INSERT INTO t2 VALUES (1065,256001,34,'Palestine','recording','imprecision','A'); +INSERT INTO t2 VALUES (1066,256002,34,'regimented','rouses','saving',''); +INSERT INTO t2 VALUES (1067,256003,34,'scars','poison','maternal',''); +INSERT INTO t2 VALUES (1068,256004,34,'realest','attitude','hewed',''); +INSERT INTO t2 VALUES (1069,256005,34,'diffusing','dusted','kerosene',''); +INSERT INTO t2 VALUES (1070,258001,34,'clubroom','encompasses','Cubans',''); +INSERT INTO t2 VALUES (1071,258002,34,'Blythe','presentation','photographers',''); +INSERT INTO t2 VALUES (1072,258003,34,'ahead','Kantian','nymph','A'); +INSERT INTO t2 VALUES (1073,258004,34,'reviver','imprecision','bedlam','A'); +INSERT INTO t2 VALUES (1074,258005,34,'retransmitting','saving','north','A'); +INSERT INTO t2 VALUES (1075,258006,34,'landslide','maternal','Schoenberg','A'); +INSERT INTO t2 VALUES (1076,258007,34,'Eiffel','hewed','botany','A'); +INSERT INTO t2 VALUES (1077,258008,34,'absentee','kerosene','curs',''); +INSERT INTO t2 VALUES (1078,258009,34,'aye','Cubans','solidification',''); +INSERT INTO t2 VALUES (1079,258010,34,'forked','photographers','inheritresses',''); +INSERT INTO t2 VALUES (1080,258011,34,'Peruvianizes','nymph','stiller',''); +INSERT INTO t2 VALUES (1081,258101,68,'clerked','bedlam','t1','A'); +INSERT INTO t2 VALUES (1082,258102,68,'tutor','north','suite','A'); +INSERT INTO t2 VALUES (1083,258103,34,'boulevard','Schoenberg','ransomer',''); +INSERT INTO t2 VALUES (1084,258104,68,'shuttered','botany','Willy',''); +INSERT INTO t2 VALUES (1085,258105,68,'quotes','curs','Rena','A'); +INSERT INTO t2 VALUES (1086,258106,68,'Caltech','solidification','Seattle','A'); +INSERT INTO t2 VALUES (1087,258107,68,'Mossberg','inheritresses','relaxes','A'); +INSERT INTO t2 VALUES (1088,258108,68,'kept','stiller','exclaim',''); +INSERT INTO t2 VALUES (1089,258109,68,'roundly','t1','implicated','A'); +INSERT INTO t2 VALUES (1090,258110,68,'features','suite','distinguish',''); +INSERT INTO t2 VALUES (1091,258111,68,'imaginable','ransomer','assayed',''); +INSERT INTO t2 VALUES (1092,258112,68,'controller','Willy','homeowner',''); +INSERT INTO t2 VALUES (1093,258113,68,'racial','Rena','and',''); +INSERT INTO t2 VALUES (1094,258201,34,'uprisings','Seattle','stealth',''); +INSERT INTO t2 VALUES (1095,258202,34,'narrowed','relaxes','coinciding','A'); +INSERT INTO t2 VALUES (1096,258203,34,'cannot','exclaim','founder','A'); +INSERT INTO t2 VALUES (1097,258204,34,'vest','implicated','environing',''); +INSERT INTO t2 VALUES (1098,258205,34,'famine','distinguish','jewelry',''); +INSERT INTO t2 VALUES (1099,258301,34,'sugars','assayed','lemons','A'); +INSERT INTO t2 VALUES (1100,258401,34,'exterminated','homeowner','brokenness','A'); +INSERT INTO t2 VALUES (1101,258402,34,'belays','and','bedpost','A'); +INSERT INTO t2 VALUES (1102,258403,34,'Hodges','stealth','assurers','A'); +INSERT INTO t2 VALUES (1103,258404,34,'translatable','coinciding','annoyers',''); +INSERT INTO t2 VALUES (1104,258405,34,'duality','founder','affixed',''); +INSERT INTO t2 VALUES (1105,258406,34,'recording','environing','warbling',''); +INSERT INTO t2 VALUES (1106,258407,34,'rouses','jewelry','seriously',''); +INSERT INTO t2 VALUES (1107,228123,37,'poison','lemons','boasted',''); +INSERT INTO t2 VALUES (1108,250606,34,'attitude','brokenness','Chantilly',''); +INSERT INTO t2 VALUES (1109,208405,37,'dusted','bedpost','Iranizes',''); +INSERT INTO t2 VALUES (1110,212101,37,'encompasses','assurers','violinist',''); +INSERT INTO t2 VALUES (1111,218206,37,'presentation','annoyers','extramarital',''); +INSERT INTO t2 VALUES (1112,150401,37,'Kantian','affixed','spates',''); +INSERT INTO t2 VALUES (1113,248212,41,'imprecision','warbling','cloakroom',''); +INSERT INTO t2 VALUES (1114,128026,00,'saving','seriously','gazer',''); +INSERT INTO t2 VALUES (1115,128024,00,'maternal','boasted','hand',''); +INSERT INTO t2 VALUES (1116,128027,00,'hewed','Chantilly','tucked',''); +INSERT INTO t2 VALUES (1117,128025,00,'kerosene','Iranizes','gems',''); +INSERT INTO t2 VALUES (1118,128109,00,'Cubans','violinist','clinker',''); +INSERT INTO t2 VALUES (1119,128705,00,'photographers','extramarital','refiner',''); +INSERT INTO t2 VALUES (1120,126303,00,'nymph','spates','callus',''); +INSERT INTO t2 VALUES (1121,128308,00,'bedlam','cloakroom','leopards',''); +INSERT INTO t2 VALUES (1122,128204,00,'north','gazer','comfortingly',''); +INSERT INTO t2 VALUES (1123,128205,00,'Schoenberg','hand','generically',''); +INSERT INTO t2 VALUES (1124,128206,00,'botany','tucked','getters',''); +INSERT INTO t2 VALUES (1125,128207,00,'curs','gems','sexually',''); +INSERT INTO t2 VALUES (1126,118205,00,'solidification','clinker','spear',''); +INSERT INTO t2 VALUES (1127,116801,00,'inheritresses','refiner','serums',''); +INSERT INTO t2 VALUES (1128,116803,00,'stiller','callus','Italianization',''); +INSERT INTO t2 VALUES (1129,116804,00,'t1','leopards','attendants',''); +INSERT INTO t2 VALUES (1130,116802,00,'suite','comfortingly','spies',''); +INSERT INTO t2 VALUES (1131,128605,00,'ransomer','generically','Anthony',''); +INSERT INTO t2 VALUES (1132,118308,00,'Willy','getters','planar',''); +INSERT INTO t2 VALUES (1133,113702,00,'Rena','sexually','cupped',''); +INSERT INTO t2 VALUES (1134,113703,00,'Seattle','spear','cleanser',''); +INSERT INTO t2 VALUES (1135,112103,00,'relaxes','serums','commuters',''); +INSERT INTO t2 VALUES (1136,118009,00,'exclaim','Italianization','honeysuckle',''); +INSERT INTO t2 VALUES (5136,1118009,00,'exclaim','Italianization','honeysuckle',''); +INSERT INTO t2 VALUES (1137,138011,00,'implicated','attendants','orphanage',''); +INSERT INTO t2 VALUES (1138,138010,00,'distinguish','spies','skies',''); +INSERT INTO t2 VALUES (1139,138012,00,'assayed','Anthony','crushers',''); +INSERT INTO t2 VALUES (1140,068304,00,'homeowner','planar','Puritan',''); +INSERT INTO t2 VALUES (1141,078009,00,'and','cupped','squeezer',''); +INSERT INTO t2 VALUES (1142,108013,00,'stealth','cleanser','bruises',''); +INSERT INTO t2 VALUES (1143,084004,00,'coinciding','commuters','bonfire',''); +INSERT INTO t2 VALUES (1144,083402,00,'founder','honeysuckle','Colombo',''); +INSERT INTO t2 VALUES (1145,084003,00,'environing','orphanage','nondecreasing',''); +INSERT INTO t2 VALUES (1146,088504,00,'jewelry','skies','innocents',''); +INSERT INTO t2 VALUES (1147,088005,00,'lemons','crushers','masked',''); +INSERT INTO t2 VALUES (1148,088007,00,'brokenness','Puritan','file',''); +INSERT INTO t2 VALUES (1149,088006,00,'bedpost','squeezer','brush',''); +INSERT INTO t2 VALUES (1150,148025,00,'assurers','bruises','mutilate',''); +INSERT INTO t2 VALUES (1151,148024,00,'annoyers','bonfire','mommy',''); +INSERT INTO t2 VALUES (1152,138305,00,'affixed','Colombo','bulkheads',''); +INSERT INTO t2 VALUES (1153,138306,00,'warbling','nondecreasing','undeclared',''); +INSERT INTO t2 VALUES (1154,152701,00,'seriously','innocents','displacements',''); +INSERT INTO t2 VALUES (1155,148505,00,'boasted','masked','nieces',''); +INSERT INTO t2 VALUES (1156,158003,00,'Chantilly','file','coeducation',''); +INSERT INTO t2 VALUES (1157,156201,00,'Iranizes','brush','brassy',''); +INSERT INTO t2 VALUES (1158,156202,00,'violinist','mutilate','authenticator',''); +INSERT INTO t2 VALUES (1159,158307,00,'extramarital','mommy','Washoe',''); +INSERT INTO t2 VALUES (1160,158402,00,'spates','bulkheads','penny',''); +INSERT INTO t2 VALUES (1161,158401,00,'cloakroom','undeclared','Flagler',''); +INSERT INTO t2 VALUES (1162,068013,00,'gazer','displacements','stoned',''); +INSERT INTO t2 VALUES (1163,068012,00,'hand','nieces','cranes',''); +INSERT INTO t2 VALUES (1164,068203,00,'tucked','coeducation','masterful',''); +INSERT INTO t2 VALUES (1165,088205,00,'gems','brassy','biracial',''); +INSERT INTO t2 VALUES (1166,068704,00,'clinker','authenticator','steamships',''); +INSERT INTO t2 VALUES (1167,068604,00,'refiner','Washoe','windmills',''); +INSERT INTO t2 VALUES (1168,158502,00,'callus','penny','exploit',''); +INSERT INTO t2 VALUES (1169,123103,00,'leopards','Flagler','riverfront',''); +INSERT INTO t2 VALUES (1170,148026,00,'comfortingly','stoned','sisterly',''); +INSERT INTO t2 VALUES (1171,123302,00,'generically','cranes','sharpshoot',''); +INSERT INTO t2 VALUES (1172,076503,00,'getters','masterful','mittens',''); +INSERT INTO t2 VALUES (1173,126304,00,'sexually','biracial','interdependency',''); +INSERT INTO t2 VALUES (1174,068306,00,'spear','steamships','policy',''); +INSERT INTO t2 VALUES (1175,143504,00,'serums','windmills','unleashing',''); +INSERT INTO t2 VALUES (1176,160201,00,'Italianization','exploit','pretenders',''); +INSERT INTO t2 VALUES (1177,148028,00,'attendants','riverfront','overstatements',''); +INSERT INTO t2 VALUES (1178,148027,00,'spies','sisterly','birthed',''); +INSERT INTO t2 VALUES (1179,143505,00,'Anthony','sharpshoot','opportunism',''); +INSERT INTO t2 VALUES (1180,108014,00,'planar','mittens','showroom',''); +INSERT INTO t2 VALUES (1181,076104,00,'cupped','interdependency','compromisingly',''); +INSERT INTO t2 VALUES (1182,078106,00,'cleanser','policy','Medicare',''); +INSERT INTO t2 VALUES (1183,126102,00,'commuters','unleashing','corresponds',''); +INSERT INTO t2 VALUES (1184,128029,00,'honeysuckle','pretenders','hardware',''); +INSERT INTO t2 VALUES (1185,128028,00,'orphanage','overstatements','implant',''); +INSERT INTO t2 VALUES (1186,018410,00,'skies','birthed','Alicia',''); +INSERT INTO t2 VALUES (1187,128110,00,'crushers','opportunism','requesting',''); +INSERT INTO t2 VALUES (1188,148506,00,'Puritan','showroom','produced',''); +INSERT INTO t2 VALUES (1189,123303,00,'squeezer','compromisingly','criticizes',''); +INSERT INTO t2 VALUES (1190,123304,00,'bruises','Medicare','backer',''); +INSERT INTO t2 VALUES (1191,068504,00,'bonfire','corresponds','positively',''); +INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky',''); +INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly',''); +--enable_query_log + +# +# Search with a key +# + +select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%"; +select fld3 from t2 where fld3 like "%cultivation" ; + +# +# Search with a key using sorting and limit the same time +# + +select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3; +select fld3,companynr from t2 where companynr = 58 order by fld3; + +select fld3 from t2 order by fld3 desc limit 10; +select fld3 from t2 order by fld3 desc limit 5; +select fld3 from t2 order by fld3 desc limit 5,5; + +# +# Search with a key having a constant with each unique key. +# The table is read directly with read-next on fld3 +# + +select t2.fld3 from t2 where fld3 = 'honeysuckle'; +select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_'; +select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_'; +select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%'; +select t2.fld3 from t2 where fld3 LIKE 'h%le'; + +select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_'; +select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%'; + +# +# Test sorting with a used key (there is no need for sorting) +# + +select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; +select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3; + +# +# Search with a key with LIKE constant +# If the like starts with a certain letter key will be used. +# + +select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; +select fld3 from t2 where fld3 like "L%" and fld3 = "ok"; +select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly"); +select fld1,fld3 from t2 where fld1 like "25050%"; +select fld1,fld3 from t2 where fld1 like "25050_"; + +# +# Test for insert after select +# +INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat',''); +INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W'); +INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring',''); +INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily',''); +SELECT * FROM t2; +drop table t1, t2; diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 5b1a5923ad4..b8574fb7623 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -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 diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test index 6281f2a4249..e5405d9f1bd 100644 --- a/mysql-test/t/ctype_ujis.test +++ b/mysql-test/t/ctype_ujis.test @@ -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; diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 4e68efeffc3..6a504a8533a 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -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 '[[:<:]]ваÑÑ[[:>:]]'; diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index aede2220466..2448a1d3209 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -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); diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index c138b848491..cc8d8a88437 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -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; diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test index 8e91e5891b8..817249b7e4c 100644 --- a/mysql-test/t/gis-rtree.test +++ b/mysql-test/t/gis-rtree.test @@ -1,3 +1,5 @@ +-- source include/have_geometry.inc + # # test of rtree (using with spatial data) # diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index ea460d5f7b0..590007caba1 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -1,3 +1,5 @@ +-- source include/have_geometry.inc + # # Spatial objects # diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 1b07ddc63a6..ea66a44d44e 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -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); diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test new file mode 100644 index 00000000000..d9e0f0852c5 --- /dev/null +++ b/mysql-test/t/ps.test @@ -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; + diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test new file mode 100644 index 00000000000..c13b57a3108 --- /dev/null +++ b/mysql-test/t/rpl_charset.test @@ -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; diff --git a/mysql-test/t/rpl_delete_all.test b/mysql-test/t/rpl_delete_all.test new file mode 100644 index 00000000000..cb6da3674da --- /dev/null +++ b/mysql-test/t/rpl_delete_all.test @@ -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; diff --git a/mysql-test/t/rpl_ps.test b/mysql-test/t/rpl_ps.test new file mode 100644 index 00000000000..79f48381a4f --- /dev/null +++ b/mysql-test/t/rpl_ps.test @@ -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; + diff --git a/mysql-test/t/rpl_server_id1.test b/mysql-test/t/rpl_server_id1.test index aefcb81c930..4d504325294 100644 --- a/mysql-test/t/rpl_server_id1.test +++ b/mysql-test/t/rpl_server_id1.test @@ -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; diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test index e63e894c1cf..c20b6e9ab6c 100644 --- a/mysql-test/t/select_found.test +++ b/mysql-test/t/select_found.test @@ -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; diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index a28b327cf58..601724e68c8 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -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; + + diff --git a/mysys/ChangeLog b/mysys/ChangeLog index e24fc00b493..7a426106667 100644 --- a/mysys/ChangeLog +++ b/mysys/ChangeLog @@ -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) diff --git a/mysys/charset.c b/mysys/charset.c index d801fcdbd76..a9c733e25cf 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -21,6 +21,344 @@ #include #include + +/* + 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 + + := A-Z | a-z | \uXXXX + + Shift command: + := & - reset at this letter. + + Diff command: + := < - Identifies a primary difference. + := << - Identifies a secondary difference. + := <<< - Idenfifies a tertiary difference. + + + Collation rules: + := { } + + := + | + | + | + + := [ ] + + 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; diff --git a/mysys/default.c b/mysys/default.c index 056f686e16f..792233ed10d 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -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; diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 530721a79ad..7b5371c4289 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -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)); diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index bce08b9795b..70b2f288538 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -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 */ diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index 2d0a5ea282b..9193238708d 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -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)); diff --git a/mysys/mf_soundex.c b/mysys/mf_soundex.c index 27ab4892c57..c0c6105a6eb 100644 --- a/mysys/mf_soundex.c +++ b/mysys/mf_soundex.c @@ -52,7 +52,7 @@ void soundex(CHARSET_INFO * cs,register my_string out_pntr, my_string in_pntr, if (remove_garbage) { - while (*in_pntr && !my_isalpha(cs,*in_pntr)) /* Skipp pre-space */ + while (*in_pntr && !my_isalpha(cs,*in_pntr)) /* Skip pre-space */ in_pntr++; } *out_pntr++ = map[(uchar)*in_pntr]; /* Copy first letter */ @@ -82,7 +82,7 @@ void soundex(CHARSET_INFO * cs,register my_string out_pntr, my_string in_pntr, /* If alpha, map input letter to soundex code. - If not alpha and remove_garbage is set then skipp to next char + If not alpha and remove_garbage is set then skip to next char else return 0 */ diff --git a/mysys/mf_wfile.c b/mysys/mf_wfile.c index b964d7ee494..7d537eaa06a 100644 --- a/mysys/mf_wfile.c +++ b/mysys/mf_wfile.c @@ -39,7 +39,7 @@ WF_PACK *wf_comp(my_string str) WF_PACK *ret; DBUG_ENTER("wf_comp"); - not_pos= -1; /* Skipp space and '!' in front */ + not_pos= -1; /* Skip space and '!' in front */ while (*str == ' ') str++; if (*str == '!') diff --git a/mysys/my_error.c b/mysys/my_error.c index 33d79bbc5e6..8a377f63c7e 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -33,6 +33,12 @@ char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE]; nr Errno MyFlags Flags ... variable list + NOTE + The following subset of printf format is supported: + "%[0-9.-]*l?[sdu]", where all length flags are parsed but ignored. + + Additionally "%.*s" is supported and "%.*[ud]" is correctly parsed but + the length value is ignored. */ int my_error(int nr,myf MyFlags, ...) @@ -43,7 +49,10 @@ int my_error(int nr,myf MyFlags, ...) reg2 char *endpos; char * par; char ebuff[ERRMSGSIZE+20]; + int prec_chars; /* output precision */ + my_bool prec_supplied; DBUG_ENTER("my_error"); + LINT_INIT(prec_chars); /* protected by prec_supplied */ va_start(ap,MyFlags); DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno)); @@ -59,7 +68,6 @@ int my_error(int nr,myf MyFlags, ...) if (tpos[0] != '%') { *endpos++= *tpos++; /* Copy ordinary char */ - olen++; continue; } if (*++tpos == '%') /* test if %% */ @@ -68,43 +76,71 @@ int my_error(int nr,myf MyFlags, ...) } else { - /* Skipp if max size is used (to be compatible with printf) */ - while (my_isdigit(&my_charset_latin1, *tpos) || *tpos == '.' || *tpos == '-') - tpos++; - if (*tpos == 'l') /* Skipp 'l' argument */ - tpos++; + /* + Skip size/precision flags to be compatible with printf. + The only size/precision flag supported is "%.*s". + If "%.*u" or "%.*d" are encountered, the precision number is read + from the variable argument list but its value is ignored. + */ + prec_supplied= 0; + if (*tpos== '.') + { + tpos++; + olen--; + if (*tpos == '*') + { + tpos++; + olen--; + prec_chars= va_arg(ap, int); /* get length parameter */ + prec_supplied= 1; + } + } + + if (!prec_supplied) + { + while (my_isdigit(&my_charset_latin1, *tpos) || *tpos == '.' || + *tpos == '-') + tpos++; + + if (*tpos == 'l') /* Skip 'l' argument */ + tpos++; + } + if (*tpos == 's') /* String parameter */ { - par = va_arg(ap, char *); - plen = (uint) strlen(par); + par= va_arg(ap, char *); + plen= (uint) strlen(par); + if (prec_supplied && prec_chars > 0) + plen= min((uint)prec_chars, plen); if (olen + plen < ERRMSGSIZE+2) /* Replace if possible */ { - endpos=strmov(endpos,par); - tpos++; - olen+=plen-2; - continue; + strmake(endpos, par, plen); + endpos+= plen; + tpos++; + olen+= plen-2; + continue; } } else if (*tpos == 'd' || *tpos == 'u') /* Integer parameter */ { register int iarg; - iarg = va_arg(ap, int); + iarg= va_arg(ap, int); if (*tpos == 'd') plen= (uint) (int10_to_str((long) iarg, endpos, -10) - endpos); else plen= (uint) (int10_to_str((long) (uint) iarg, endpos, 10) - endpos); if (olen + plen < ERRMSGSIZE+2) /* Replace parameter if possible */ { - endpos+=plen; + endpos+= plen; tpos++; - olen+=plen-2; + olen+= plen-2; continue; } } } - *endpos++='%'; /* % used as % or unknown code */ + *endpos++= '%'; /* % used as % or unknown code */ } - *endpos='\0'; /* End of errmessage */ + *endpos= '\0'; /* End of errmessage */ va_end(ap); DBUG_RETURN((*error_handler_hook)(nr, ebuff, MyFlags)); } diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index a08d28d8545..fd47c532cff 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -108,7 +108,7 @@ int my_setwd(const char *dir, myf MyFlags) { uint drive,drives; - pos++; /* Skipp FN_DEVCHAR */ + pos++; /* Skip FN_DEVCHAR */ drive=(uint) (my_toupper(&my_charset_latin1,dir[0])-'A'+1); drives= (uint) -1; if ((pos-(byte*) dir) == 2 && drive > 0 && drive < 32) diff --git a/ndb/BinDist.sh b/ndb/BinDist.sh deleted file mode 100644 index 3574b0d64ce..00000000000 --- a/ndb/BinDist.sh +++ /dev/null @@ -1,120 +0,0 @@ -# -# Invoked from scripts/make_binary_distribution as "sh BinDist.sh". -# Prints list of dirs and files to include under mysql/ndb. -# - -# release notes - -grep -v '^#' <<__END__ -#ReleaseNotes.html -mysqlclusterenv.sh -__END__ - -# subset of bins, libs, includes - -grep -v '^#' <<__END__ -bin/ -bin/ndb -bin/mgmtsrvr -bin/mgmtclient -bin/mysqlcluster -bin/mysqlcluster_install_db -bin/mysqlclusterd -bin/restore -bin/ndb_rep -bin/desc -bin/flexBench -bin/select_all -bin/select_count -bin/delete_all -#bin/ndbsql -bin/drop_tab -bin/drop_index -bin/list_tables -bin/waiter -lib/ -lib/libNEWTON_API.a -lib/libNEWTON_API.so -lib/libNDB_API.a -lib/libNDB_API.so -lib/libMGM_API.a -lib/libMGM_API.so -#lib/libNDB_ODBC.so -lib/libMGM_API_pic.a -lib/libNDB_API_pic.a -include/ -include/ndb_types.h -include/ndb_version.h -include/mgmapi/ -include/mgmapi/mgmapi.h -include/mgmapi/mgmapi_debug.h -include/ndbapi/ -include/ndbapi/ndbapi_limits.h -include/ndbapi/Ndb.hpp -include/ndbapi/NdbApi.hpp -include/ndbapi/NdbConnection.hpp -include/ndbapi/NdbCursorOperation.hpp -include/ndbapi/NdbDictionary.hpp -include/ndbapi/NdbError.hpp -include/ndbapi/NdbEventOperation.hpp -include/ndbapi/NdbIndexOperation.hpp -include/ndbapi/NdbOperation.hpp -include/ndbapi/NdbPool.hpp -include/ndbapi/NdbRecAttr.hpp -include/ndbapi/NdbReceiver.hpp -include/ndbapi/NdbResultSet.hpp -include/ndbapi/NdbScanFilter.hpp -include/ndbapi/NdbScanOperation.hpp -include/ndbapi/NdbSchemaCon.hpp -include/ndbapi/NdbSchemaOp.hpp -include/newtonapi/dba.h -include/newtonapi/defs/pcn_types.h -__END__ - -#if [ -f /usr/local/lib/libstdc++.a ]; then -# cp /usr/local/lib/libstdc++.a lib/. -# echo lib/libstdc++.a -#fi -#if [ -f /usr/local/lib/libstdc++.so.5 ]; then -# cp /usr/local/lib/libstdc++.so.5 lib/. -# echo lib/libstdc++.so.5 -#fi -#if [ -f /usr/local/lib/libgcc_s.so.1 ]; then -# cp /usr/local/lib/libgcc_s.so.1 lib/. -# echo lib/libgcc_s.so.1 -#fi - -# docs - -#find docs/*.html docs/*.pdf -print | sort -t/ - -# demos - -find demos -print | grep -v /SCCS | sort -t/ - -# examples - -grep -v '^#' <<__END__ -examples/ -examples/Makefile -examples/ndbapi_example1/ -examples/ndbapi_example1/Makefile -examples/ndbapi_example1/ndbapi_example1.cpp -examples/ndbapi_example2/ -examples/ndbapi_example2/Makefile -examples/ndbapi_example2/ndbapi_example2.cpp -examples/ndbapi_example3/ -examples/ndbapi_example3/Makefile -examples/ndbapi_example3/ndbapi_example3.cpp -examples/ndbapi_example4/ -examples/ndbapi_example4/Makefile -examples/ndbapi_example4/ndbapi_example4.cpp -examples/ndbapi_example5/ -examples/ndbapi_example5/Makefile -examples/ndbapi_example5/ndbapi_example5.cpp -examples/select_all/ -examples/select_all/Makefile -examples/select_all/select_all.cpp -__END__ - -exit 0 diff --git a/ndb/Defs.mk b/ndb/Defs.mk deleted file mode 100644 index ac4507562fd..00000000000 --- a/ndb/Defs.mk +++ /dev/null @@ -1,64 +0,0 @@ -include $(NDB_TOP)/config/config.mk -include $(NDB_TOP)/config/Defs.$(NDB_VERSION).mk -include $(NDB_TOP)/config/Defs.$(NDB_OS).$(NDB_ARCH).$(NDB_COMPILER).mk - -ifeq ($(NDB_OS), WIN32) -# Windows specific definitions -OBJEXT := obj -LIBEXT := lib -LIBPREFIX := -fixpath = `cygpath -w $1` -ar_rcs = lib -out:`cygpath -w $1` $2 -link_so = link -DLL -OUT:`cygpath -w $1` $(WIN_LIBS) $2 -#check-odbc = Y -USE_EDITLINE := N -#STRCASECMP is defined in include/portlib/PortDefs.h to _strcmpi -else -#Common definitions for almost all non-Windows environments -OBJEXT := o -LIBEXT := a -LIBPREFIX := lib -fixpath = $1 -ar_rcs = $(AR_RCS) $1 $2 -#check-odbc = $(findstring sqlext.h, $(wildcard /usr/include/sqlext.h) $(wildcard /usr/local/include/sqlext.h)) -endif - -ifeq ($(NDB_OS), WIN32) -SHLIBEXT := dll -endif - -ifeq ($(NDB_OS), LINUX) -SHLIBEXT := so -endif - -ifeq ($(NDB_OS), SOLARIS) -SHLIBEXT := so -endif - -ifeq ($(NDB_OS), HPUX) -SHLIBEXT := sl -endif - -ifeq ($(NDB_OS), MACOSX) -SHLIBEXT := dylib -endif - -ifeq ($(NDB_OS), OSE) -SHLIBEXT := so -endif - -ifeq ($(NDB_OS), SOFTOSE) -SHLIBEXT := so -endif - -ifeq ($(NDB_SCI), Y) -CCFLAGS_TOP += -DHAVE_NDB_SCI -endif - -ifeq ($(NDB_SHM), Y) -CCFLAGS_TOP += -DHAVE_NDB_SHM -endif - -ifneq ($(findstring OSE, $(NDB_OS)),) -USE_EDITLINE := N -endif diff --git a/ndb/Epilogue.mk_old b/ndb/Epilogue.mk_old deleted file mode 100644 index 36d9ebd6751..00000000000 --- a/ndb/Epilogue.mk_old +++ /dev/null @@ -1,878 +0,0 @@ -# .KEEP_STATE: -# bk test !!! - -### -# For building some intermediary targets in /tmp (only useful on solaris) -ifneq ($(NDB_BUILDROOT),) -NDB_TOPABS := $(shell cd $(NDB_TOP) && /bin/pwd) -NDB_BUILDDIR := $(subst $(NDB_TOPABS),$(NDB_BUILDROOT),$(CURDIR))/ -ifeq ($(wildcard $(NDB_BUILDDIR)),) -dummy := $(shell mkdir -p $(NDB_BUILDDIR)) -endif -endif - -### -CCFLAGS_TOP += -DNDB_$(NDB_OS) -DNDB_$(NDB_ARCH) -DNDB_$(NDB_COMPILER) - -ifdef BIN_TARGET -BIN_EXE = Y -endif - -### -# -# OS specifics -# - -# Disable shared libraries on HP-UX for the time being. -ifeq ($(NDB_OS), HPUX) - SO_LIB := N - PIC_LIB := N - PIC_ARCHIVE := N - NONPIC_ARCHIVE := Y -endif - -ifeq ($(NDB_OS), OSE) - SO_LIB := N - PIC_LIB := N - PIC_ARCHIVE := N - NONPIC_ARCHIVE := Y - -ifdef BIN_TARGET - BIN_LIB_TARGET := lib$(BIN_TARGET).a - BIN_TARGET := lib$(BIN_TARGET).a -endif -endif - -ifeq ($(NDB_OS), SOFTOSE) - SO_LIB := N - PIC_LIB := N - PIC_ARCHIVE := N - -ifdef BIN_TARGET - BIN_EXE_TARGET := $(BIN_TARGET) - BIN_LIB_TARGET := lib$(BIN_TARGET).a - EXTRA_MAIN := osemain.o -endif -endif - -ifeq ($(filter OSE, $(NDB_OS)),) - BIN_EXE_TARGET := $(BIN_TARGET) -endif - - -ifeq ($(NDB_OS), MACOSX) -.LIBPATTERNS= lib%.dylib lib%.a -endif - -### -# -# - -### -# External dependencies definition : the place we store libraries -# we get from outside the NDB development group. -EXTERNAL_DEPENDS_TOP=$(NDB_TOP)/src/external/$(NDB_OS).$(NDB_ARCH) - - -### -# -# TYPE Handling - -# -# TYPE := kernel -# -ifneq ($(filter kernel, $(TYPE)),) -CCFLAGS_LOC += \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/vm) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/error) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel) \ - -I$(call fixpath,$(NDB_TOP)/include/kernel) \ - -I$(call fixpath,$(NDB_TOP)/include/transporter) \ - -I$(call fixpath,$(NDB_TOP)/include/debugger) \ - -I$(call fixpath,$(NDB_TOP)/include/mgmcommon) \ - -I$(call fixpath,$(NDB_TOP)/include/mgmapi) \ - -I$(call fixpath,$(NDB_TOP)/include/ndbapi) \ - -I$(call fixpath,$(NDB_TOP)/include/util) \ - -I$(call fixpath,$(NDB_TOP)/include/portlib) \ - -I$(call fixpath,$(NDB_TOP)/include/logger) -endif - -# -# TYPE := ndbapi -# -ifneq ($(filter ndbapi, $(TYPE)),) -CCFLAGS_LOC += \ - -I$(call fixpath,$(NDB_TOP)/include/kernel) \ - -I$(call fixpath,$(NDB_TOP)/include/transporter) \ - -I$(call fixpath,$(NDB_TOP)/include/debugger) \ - -I$(call fixpath,$(NDB_TOP)/include/mgmcommon) \ - -I$(call fixpath,$(NDB_TOP)/include/mgmapi) \ - -I$(call fixpath,$(NDB_TOP)/include/ndbapi) \ - -I$(call fixpath,$(NDB_TOP)/include/util) \ - -I$(call fixpath,$(NDB_TOP)/include/portlib) \ - -I$(call fixpath,$(NDB_TOP)/include/logger) -endif - -# -# TYPE := ndbapiclient -# -ifneq ($(filter ndbapiclient, $(TYPE)),) -CCFLAGS_LOC += \ - -I$(call fixpath,$(NDB_TOP)/include/ndbapi) - -BIN_TARGET_LIBS += NDB_API -endif - -# -# TYPE := mgmapiclient -# -ifneq ($(filter mgmapiclient, $(TYPE)),) -CCFLAGS_LOC += \ - -I$(call fixpath,$(NDB_TOP)/include/mgmapi) - -BIN_TARGET_LIBS += MGM_API -endif - -# -# TYPE := ndbapitest -# -ifneq ($(filter ndbapitest, $(TYPE)),) -CCFLAGS_LOC += \ - -I$(call fixpath,$(NDB_TOP)/include/ndbapi) \ - -I$(call fixpath,$(NDB_TOP)/include/util) \ - -I$(call fixpath,$(NDB_TOP)/include/portlib) \ - -I$(call fixpath,$(NDB_TOP)/test/include) \ - -I$(call fixpath,$(NDB_TOP)/include/mgmapi) - -BIN_TARGET_LIBS += NDBT -LDFLAGS_LOC += -lNDB_API -lMGM_API -lm - -endif - -# -# TYPE := signalsender -# -ifneq ($(filter signalsender, $(TYPE)),) -CCFLAGS_LOC += \ - -I$(call fixpath,$(NDB_TOP)/include/ndbapi) \ - -I$(call fixpath,$(NDB_TOP)/src/ndbapi) \ - -I$(call fixpath,$(NDB_TOP)/src/ndbapi/signal-sender) \ - -I$(call fixpath,$(NDB_TOP)/include/util) \ - -I$(call fixpath,$(NDB_TOP)/include/portlib) \ - -I$(call fixpath,$(NDB_TOP)/include/transporter) \ - -I$(call fixpath,$(NDB_TOP)/include/mgmcommon) \ - -I$(call fixpath,$(NDB_TOP)/include/kernel) - -BIN_TARGET_LIBS += NDB_API -BIN_TARGET_ARCHIVES += editline signal-sender - -endif - - -# -# TYPE := repserver -# -ifneq ($(filter repserver, $(TYPE)),) -CCFLAGS_LOC += \ - -I$(call fixpath,$(NDB_TOP)/include/ndbapi) \ - -I$(call fixpath,$(NDB_TOP)/src) \ - -I$(call fixpath,$(NDB_TOP)/src/ndbapi) \ - -I$(call fixpath,$(NDB_TOP)/src/ndbapi/signal-sender) \ - -I$(call fixpath,$(NDB_TOP)/include/util) \ - -I$(call fixpath,$(NDB_TOP)/include/portlib) \ - -I$(call fixpath,$(NDB_TOP)/include/transporter) \ - -I$(call fixpath,$(NDB_TOP)/include/mgmcommon) \ - -I$(call fixpath,$(NDB_TOP)/include/kernel) -endif - -# -# TYPE := odbcclient -# - -ifneq ($(filter odbcclient, $(TYPE)),) -TYPE += util -LDFLAGS_LOC += -lm -#ifneq ($(call check-odbc),) -ifneq ($(NDB_ODBC),N) -ifeq ($(NDB_OS), SOLARIS) -CCFLAGS_LOC += -I/usr/local/include -BIN_TARGET_LIBS_DIRS += /usr/local/lib -BIN_TARGET_LIBS += odbc odbcinst NDBT -endif -ifeq ($(NDB_OS), LINUX) -BIN_TARGET_LIBS += odbc odbcinst NDBT -endif -ifeq ($(NDB_OS), MACOSX) -BIN_TARGET_LIBS += odbc odbcinst NDBT -endif -ifeq ($(NDB_OS), IBMAIX) -BIN_TARGET_LIBS += odbc odbcinst NDBT -endif -ifeq ($(NDB_OS), TRU64X) -BIN_TARGET_LIBS += odbc odbcinst NDBT -endif -else -BIN_EXE = N -endif -endif - -# -# TYPE := * -# -# -# TYPE := util -# -ifneq ($(filter util, $(TYPE)),) -CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include/util) \ - -I$(call fixpath,$(NDB_TOP)/include/portlib) \ - -I$(call fixpath,$(NDB_TOP)/include/logger) -BIN_TARGET_LIBS += logger general portlib -endif - -CCFLAGS_LOC += -I$(call fixpath,$(NDB_TOP)/include) -I$(call fixpath,$(NDB_TOP)/../include) - -ifeq ($(NDB_SCI), Y) -BIN_TARGET_LIBS += sisci -BIN_TARGET_LIBS_DIRS += $(EXTERNAL_DEPENDS_TOP)/sci/lib - -CCFLAGS_LOC += -I$(call fixpath,$(EXTERNAL_DEPENDS_TOP)/sci/include) -endif - -# -# TYPE Handling -### - -### -# -# First rule -# -first: - $(MAKE) libs - $(MAKE) bins - -ifeq ($(findstring all,$(replace-targets)),) -all: first -endif - -### -# -# Nice to have rules -api: libs - $(MAKE) -C $(NDB_TOP)/src/ndbapi bins - -mgm: libs - $(MAKE) -C $(NDB_TOP)/src/mgmsrv bins - -ndb: libs - $(MAKE) -C $(NDB_TOP)/src/kernel/ndb-main bins - -apitest: first - $(MAKE) -C $(NDB_TOP)/test/ndbapi all - -#-lNDBT: -# $(MAKE) -C $(NDB_TOP)/test/src all -# -#-lNDB_API: libs -# $(MAKE) -C $(NDB_TOP)/src/ndbapi bins - -# -# Libs/Bins -# -ifdef PREREQ_LOC -_libs:: $(PREREQ_LOC) -_bins:: $(PREREQ_LOC) -endif - -L_DIRS := $(LIB_DIRS) $(DIRS) -B_DIRS := $(BIN_DIRS) $(DIRS) -A_DIRS := $(LIB_DIRS) $(BIN_DIRS) $(DIRS) - -_libs:: - -_bins:: - -libs: _libs $(patsubst %, _libs_%, $(L_DIRS)) -$(patsubst %, _libs_%, $(L_DIRS)) : DUMMY - $(MAKE) -C $(patsubst _libs_%,%,$@) libs - -bins: _bins $(patsubst %, _bins_%, $(B_DIRS)) -$(patsubst %, _bins_%, $(B_DIRS)) : DUMMY - $(MAKE) -C $(patsubst _bins_%,%,$@) bins - -### -# -# Links -_links: - -$(NDB_TOP)/tools/make-links.sh $(NDB_TOP)/include `pwd` - -links: _links $(patsubst %, _links_%, $(A_DIRS)) -$(patsubst %, _links_%, $(A_DIRS)) : DUMMY - $(MAKE) -C $(patsubst _links_%,%,$@) links - - -#### -# -# OSE build_spec ( -ifdef SOURCES -BS := Y -endif - -ifdef SOURCES_c -BS := Y -endif - -_build_spec: Makefile -ifdef BS - @echo "TYPE = SWU" > build.spec - @echo "include $(NDB_TOP)/Ndb.mk" >> build.spec -# @for i in $(CCFLAGS_LOC); do echo "INC += $$i" >> build.spec ; done - @for i in $(patsubst -I%, %, $(CCFLAGS_LOC)); do echo "INC += $$i" >> build.spec ; done - @echo "INC += /vobs/cello/cls/rtosi_if/include" >> build.spec - @echo "INC += /vobs/cello/cls/rtosi_if/include.@@@" >> build.spec - @echo "INC += /vobs/cello/cls/rtosi_if/include.<<<" >> build.spec -endif - -build_spec: _build_spec $(patsubst %, _build_spec_%, $(A_DIRS)) -$(patsubst %, _build_spec_%, $(A_DIRS)) : DUMMY - $(MAKE) -C $(patsubst _build_spec_%,%,$@) build_spec - -### -# -# Phony targets - -.PHONY: $(A_DIRS) - -### -# -# Dummy rule - -DUMMY: - -### -# -# Definitions of... - -PIC_DIR := $(NDB_BUILDDIR).pic -A_TMP_DIR := $(NDB_BUILDDIR).a_tmp -SO_TMP_DIR := $(NDB_BUILDDIR).so_tmp -PIC_TMP_DIR := $(NDB_BUILDDIR).pic_tmp - -$(PIC_DIR): - mkdir -p $(PIC_DIR) - -SRC_C := $(filter %.C, $(SOURCES)) -SRC_CPP := $(filter %.cpp, $(SOURCES)) -SRC_CC := $(filter %.cc, $(SOURCES)) -SRC_c := $(filter %.c, $(SOURCES)) $(filter %.c, $(SOURCES.c)) -SRC_YPP := $(filter %.ypp, $(SOURCES)) -SRC_LPP := $(filter %.lpp, $(SOURCES)) - -OBJECTS := $(SRC_C:%.C=%.$(OBJEXT)) \ - $(SRC_CPP:%.cpp=%.$(OBJEXT)) \ - $(SRC_CC:%.cc=%.$(OBJEXT)) \ - $(SRC_c:%.c=%.$(OBJEXT)) \ - $(SRC_YPP:%.ypp=%.tab.$(OBJEXT)) \ - $(SRC_LPP:%.lpp=%.yy.$(OBJEXT)) \ - $(OBJECTS_LOC) - -PIC_OBJS := $(OBJECTS:%=$(PIC_DIR)/%) - -LIB_DIR := $(NDB_TOP)/lib -BIN_DIR := $(NDB_TOP)/bin - -### -# -# ARCHIVE_TARGET -# -ifdef ARCHIVE_TARGET - -ifndef NONPIC_ARCHIVE -NONPIC_ARCHIVE := Y -endif - -ifeq ($(NONPIC_ARCHIVE), Y) -_libs:: $(LIB_DIR)/$(LIBPREFIX)$(ARCHIVE_TARGET).$(LIBEXT) -$(LIB_DIR)/$(LIBPREFIX)$(ARCHIVE_TARGET).$(LIBEXT) : $(OBJECTS) - $(call ar_rcs,$@,$(OBJECTS)) - -endif # NONPIC_ARCHIVE := Y - -ifeq ($(PIC_ARCHIVE), Y) -_libs:: $(PIC_DIR) $(LIB_DIR)/$(LIBPREFIX)$(ARCHIVE_TARGET)_pic.$(LIBEXT) -$(LIB_DIR)/$(LIBPREFIX)$(ARCHIVE_TARGET)_pic.$(LIBEXT) : $(PIC_OBJS) - cd $(PIC_DIR) && $(call ar_rcs,../$@,$(OBJECTS)) - -PIC_DEP := Y - -endif # PIC_ARCHIVE := Y - -endif # ARCHIVE_TARGET - -### -# -# LIB_TARGET -# -ifdef LIB_TARGET - -ifeq ($(A_LIB), Y) - -A_LIB_ARCHIVES := $(LIB_TARGET_ARCHIVES:%=$(LIB_DIR)/$(LIBPREFIX)%.$(LIBEXT)) - -_bins:: $(LIB_DIR)/$(LIBPREFIX)$(LIB_TARGET).$(LIBEXT) -$(LIB_DIR)/$(LIBPREFIX)$(LIB_TARGET).$(LIBEXT) : $(A_LIB_ARCHIVES) - @rm -rf $(A_TMP_DIR) && mkdir $(A_TMP_DIR) - cd $(A_TMP_DIR) && for i in $^; do ar -x ../$$i; done && $(call ar_rcs,../$@,*.$(OBJEXT)) - $(NDB_TOP)/home/bin/ndb_deploy $@ -endif # A_LIB := Y - -ifeq ($(SO_LIB), Y) -ifneq ($(NDB_OS), WIN32) -SO_LIB_ARCHIVES := $(LIB_TARGET_ARCHIVES:%=$(LIB_DIR)/$(LIBPREFIX)%_pic.$(LIBEXT)) - -_bins:: $(LIB_DIR)/$(LIBPREFIX)$(LIB_TARGET).$(SHLIBEXT) -$(LIB_DIR)/$(LIBPREFIX)$(LIB_TARGET).$(SHLIBEXT) : $(SO_LIB_ARCHIVES) - @rm -rf $(SO_TMP_DIR) && mkdir $(SO_TMP_DIR) - cd $(SO_TMP_DIR) && for i in $^; do ar -x ../$$i; done -ifneq ($(NDB_OS), MACOSX) - $(SO) $@.new $(SO_TMP_DIR)/*.$(OBJEXT) -L$(LIB_DIR) $(LIB_TARGET_LIBS) $(LDFLAGS_LAST) - rm -f $@; mv $@.new $@ -else - $(SO) $@ $(SO_TMP_DIR)/*.$(OBJEXT) -L$(LIB_DIR) $(LIB_TARGET_LIBS) $(LDFLAGS_LAST) -endif -ifeq ($(NDB_VERSION), RELEASE) -ifneq ($(NDB_OS), MACOSX) - strip $@ -endif -endif - $(NDB_TOP)/home/bin/ndb_deploy $@ -else # WIN32 -SO_LIB_ARCHIVES := $(LIB_TARGET_ARCHIVES:%=$(LIB_DIR)/$(LIBPREFIX)%_pic.$(LIBEXT)) - -_bins:: $(LIB_DIR)/$(LIBPREFIX)$(LIB_TARGET).$(SHLIBEXT) -$(LIB_DIR)/$(LIBPREFIX)$(LIB_TARGET).$(SHLIBEXT) : $(SO_LIB_ARCHIVES) - @rm -rf $(SO_TMP_DIR) && mkdir $(SO_TMP_DIR) - cd $(SO_TMP_DIR) && for i in $^; do ar -x ../$$i; done - $(call link_so,$@.new,$(SO_TMP_DIR)/*.$(OBJEXT)) - rm -f $@; mv $@.new $@ -#ifeq ($(NDB_VERSION), RELEASE) -# strip $@ -#endif - -endif -endif # SO_LIB := Y - -ifeq ($(PIC_LIB), Y) - -PIC_LIB_ARCHIVES := $(LIB_TARGET_ARCHIVES:%=$(LIB_DIR)/$(LIBPREFIX)%_pic.$(LIBEXT)) - -_bins:: $(LIB_DIR)/$(LIBPREFIX)$(LIB_TARGET)_pic.$(LIBEXT) -$(LIB_DIR)/$(LIBPREFIX)$(LIB_TARGET)_pic.$(LIBEXT) : $(PIC_LIB_ARCHIVES) - @rm -rf $(PIC_TMP_DIR) && mkdir $(PIC_TMP_DIR) - cd $(PIC_TMP_DIR) && for i in $^; do ar -x ../$$i; done && $(call ar_rcs,../$@,*.$(OBJEXT)) - -endif # PIC_LIB := Y - -endif # LIB_TARGET - -### -# -# BIN_TARGET -# -ifeq ($(BIN_EXE), Y) -ifneq ($(NDB_OS), WIN32) -BIN_LIBS := $(BIN_TARGET_ARCHIVES:%=$(LIB_DIR)/$(LIBPREFIX)%.$(LIBEXT)) -BIN_LIBS += $(BIN_TARGET_LIBS:%=-l%) - -BIN_DEPS := $(OBJECTS) $(EXTRA_MAIN) $(BIN_LIBS) -BIN_LIB_DIRS := $(BIN_TARGET_LIBS_DIRS:%=-L%) - -BIN_FLAGS := $(BIN_LIB_DIRS) $(BIN_DEPS) - -VPATH := $(LIB_DIR) $(BIN_TARGET_LIBS_DIRS) -_bins:: $(BIN_DIR)/$(BIN_TARGET) -$(BIN_DIR)/$(BIN_TARGET) : $(BIN_DEPS) - $(LINK.cc) $(LDFLAGS) $(LDLIBS) -L$(LIB_DIR) $(BIN_FLAGS) -o $@.new $(LDFLAGS_LAST) - rm -f $@; mv $@.new $@ -ifeq ($(NDB_VERSION), RELEASE) -ifneq ($(NDB_OS), MACOSX) - strip $@ -endif -endif - $(NDB_TOP)/home/bin/ndb_deploy $@ -else # WIN32 -BIN_LIBS := $(foreach lib,$(BIN_TARGET_ARCHIVES),$(call fixpath,$(LIB_DIR)/$(LIBPREFIX)$(lib).$(LIBEXT))) -BIN_LIBS += $(BIN_TARGET_LIBS:%=$(LIBPREFIX)%.$(LIBEXT)) - -BIN_DEPS := $(OBJECTS) $(BIN_TARGET_ARCHIVES:%=$(LIB_DIR)/$(LIBPREFIX)%.$(LIBEXT)) -BIN_LIB_DIRS := -libpath:$(call fixpath,$(LIB_DIR)) $(BIN_TARGET_LIBS_DIRS:%=-libpath:%) - -BIN_FLAGS := $(BIN_LIB_DIRS) - -VPATH := $(LIB_DIR) $(BIN_TARGET_LIBS_DIRS) -_bins:: $(BIN_DIR)/$(BIN_TARGET).exe -$(BIN_DIR)/$(BIN_TARGET).exe : $(BIN_DEPS) - $(LINK.cc) -out:$(call fixpath,$@.new) $(OBJECTS) $(BIN_FLAGS) $(BIN_LIBS) - rm -f $@; mv $@.new $@ -ifeq ($(NDB_VERSION), RELEASE) - strip $@ -endif - -endif -endif - -### -# -# SOURCES.sh -# -ifdef SOURCES.sh - -BIN_SRC := $(SOURCES.sh:%=$(BIN_DIR)/%) - -_bins:: $(BIN_SRC) - -$(BIN_SRC) : $(SOURCES.sh) - rm -f $(^:%=$(BIN_DIR)/%) - cp $^ $(BIN_DIR) -endif - -# -# Compile rules PIC objects -# -ifeq ($(NDB_OS), WIN32) -OUT := -Fo -else -OUT := -o -endif - -$(PIC_DIR)/%.$(OBJEXT): %.C - $(C++) $(OUT)$@ -c $(CCFLAGS) $(CFLAGS_$<) $(PIC) $< - -$(PIC_DIR)/%.$(OBJEXT): %.cpp - $(C++) $(OUT)$@ -c $(CCFLAGS) $(CFLAGS_$<) $(PIC) $< - -$(PIC_DIR)/%.$(OBJEXT): %.cc - $(C++) $(OUT)$@ -c $(CCFLAGS) $(CFLAGS_$<) $(PIC) $< - -$(PIC_DIR)/%.$(OBJEXT): %.c - $(CC) $(OUT)$@ -c $(CFLAGS) $(CFLAGS_$<) $(PIC) $< - -# -# Compile rules -# -%.$(OBJEXT) : %.cpp - $(C++) $(OUT)$@ -c $(CCFLAGS) $(CFLAGS_$<) $(NON_PIC) $< - -%.$(OBJEXT) : %.C - $(C++) $(OUT)$@ -c $(CCFLAGS) $(CFLAGS_$<) $(NON_PIC) $< - -%.$(OBJEXT) : %.cc - $(C++) $(OUT)$@ -c $(CCFLAGS) $(CFLAGS_$<) $(NON_PIC) $< - -%.$(OBJEXT) : %.c - $(CC) $(OUT)$@ -c $(CFLAGS) $(CFLAGS_$<) $(NON_PIC) $< - -%.s : %.C - $(C++) -S $(CCFLAGS) $(CFLAGS_$<) $(NON_PIC) $< - -%.s : %.cpp - $(C++) -S $(CCFLAGS) $(CFLAGS_$<) $(NON_PIC) $< - -%.s : %.cc - $(C++) -S $(CCFLAGS) $(CFLAGS_$<) $(NON_PIC) $< - -%.s : %.c - $(CC) -S $(CCFLAGS) $(CFLAGS_$<) $(NON_PIC) $< - -BISON = bison -BISONHACK = : -%.tab.cpp %.tab.hpp : %.ypp - $(BISON) $< - $(BISONHACK) $*.tab.cpp $*.tab.hpp - -FLEX = flex -FLEXHACK = : -%.yy.cpp : %.lpp - $(FLEX) -o$@ $< - $(FLEXHACK) $@ - -### -# -# Defines regarding dependencies - -DEPMK := $(NDB_BUILDDIR).depend.mk - -DEPDIR := $(NDB_BUILDDIR).depend - -DEPENDENCIES := $(SRC_C:%.C=$(DEPDIR)/%.d) \ - $(SRC_CC:%.cc=$(DEPDIR)/%.d) \ - $(SRC_CPP:%.cpp=$(DEPDIR)/%.d) \ - $(SRC_c:%.c=$(DEPDIR)/%.d) \ - $(SRC_YPP:%.ypp=$(DEPDIR)/%.tab.d) \ - $(SRC_LPP:%.lpp=$(DEPDIR)/%.yy.d) - -### -# -# Dependency rule - -_depend: $(DEPMK) - -depend: _depend $(patsubst %, _depend_%, $(A_DIRS)) - -$(patsubst %, _depend_%, $(A_DIRS)) : DUMMY - $(MAKE) -C $(patsubst _depend_%,%,$@) depend - -### -# -# Clean dependencies - -_clean_dep: - -rm -rf $(DEPMK) $(DEPDIR)/* - -clean_dep: _clean_dep $(patsubst %, _clean_dep_%, $(A_DIRS)) - -$(patsubst %, _clean_dep_%, $(A_DIRS)) : DUMMY - $(MAKE) -C $(patsubst _clean_dep_%,%,$@) clean_dep - -### -# -# Generate dependencies - -$(DEPDIR): - -@mkdir -p $(DEPDIR) - -$(DEPDIR)/%.d: %.C - @echo Generating depend for $< - @$(MAKEDEPEND) $(CCFLAGS) $(CFLAGS_$<) $< >$@ - -$(DEPDIR)/%.d: %.c - @echo Generating depend for $< - @$(MAKEDEPEND) $(CCFLAGS) $(CFLAGS_$<) $< >$@ - -$(DEPDIR)/%.d: %.cpp - @echo Generating depend for $< - @$(MAKEDEPEND) $(CCFLAGS) $(CFLAGS_$<) $< >$@ - -$(DEPDIR)/%.d: %.cc - @echo Generating depend for $< - @$(MAKEDEPEND) $(CCFLAGS) $(CFLAGS_$<) $< >$@ - -ifeq ($(NDB_OS), WIN32) -ifndef PIC_DEP -DEP_PTN := -e 's/\(.*\)\.o[ :]*/\1.$(OBJEXT) $(DEPDIR)\/\1.d : /g' -else -DEP_PTN := -e 's/\(.*\)\.o[ :]*/\1.$(OBJEXT) $(PIC_DIR)\/\1.$(OBJEXT) $(DEPDIR)\/\1.d : /g' -endif -else -ifndef PIC_DEP -DEP_PTN := -e 's!\(.*\)\.$(OBJEXT)[ :]*!\1.$(OBJEXT) $(DEPDIR)\/\1.d : !g' -else -DEP_PTN := -e 's!\(.*\)\.$(OBJEXT)[ :]*!\1.$(OBJEXT) $(PIC_DIR)\/\1.$(OBJEXT) $(DEPDIR)\/\1.d : !g' -endif -endif -#DEP_PTN += -e 's!/usr/include/[-+a-zA-Z0-9_/.]*!!g' -#DEP_PTN += -e 's!/usr/local/lib/gcc-lib/[-+a-zA-Z0-9_/.]*!!g' - -$(DEPMK): $(DEPDIR) $(SRC_YPP:%.ypp=%.tab.hpp) $(SRC_LPP:%.lpp=%.yy.cpp) $(DEPENDENCIES) $(wildcard $(NDB_TOP)/.update.d) - @echo "updating .depend.mk" - @sed $(DEP_PTN) /dev/null $(DEPENDENCIES) >$(DEPMK) - -### -# -# clean -# -_clean: - -rm -rf SunWS_cache $(PIC_DIR)/SunWS_cache -ifeq ($(NONPIC_ARCHIVE), Y) - -rm -f $(OBJECTS) $(LIB_DIR)/$(LIBPREFIX)$(ARCHIVE_TARGET).$(LIBEXT) -endif -ifeq ($(PIC_ARCHIVE), Y) - -rm -f $(PIC_OBJS) $(LIB_DIR)/$(LIBPREFIX)$(ARCHIVE_TARGET)_pic.$(LIBEXT) -endif -ifdef BIN_TARGET - -rm -f $(OBJECTS) -endif -ifdef LIB_TARGET -ifeq ($(A_LIB), Y) - -rm -f $(A_TMP_DIR)/* -endif -ifeq ($(SO_LIB), Y) - -rm -f $(SO_TMP_DIR)/* -endif -ifeq ($(PIC_LIB), Y) - -rm -f $(PIC_TMP_DIR)/* -endif -endif -ifneq ($(SRC_YPP),) - -rm -f $(SRC_YPP:%.ypp=%.tab.[hc]pp) $(SRC_YPP:%.ypp=%.output) -endif -ifneq ($(SRC_LPP),) - -rm -f $(SRC_LPP:%.lpp=%.yy.*) -endif -ifdef CLEAN_LOC - -rm -f $(CLEAN_LOC) -endif - -### -# -# clean all -# -clobber: cleanall -_cleanall: _clean clean_links - -rm -f osemain.con osemain.c -ifdef LIB_TARGET -ifeq ($(A_LIB), Y) - -rm -f $(LIB_DIR)/$(LIBPREFIX)$(LIB_TARGET).$(LIBEXT) -endif -ifeq ($(SO_LIB), Y) - -rm -f $(LIB_DIR)/$(LIBPREFIX)$(LIB_TARGET).$(SHLIBEXT) -endif -ifeq ($(PIC_LIB), Y) - -rm -f $(LIB_DIR)/$(LIBPREFIX)$(LIB_TARGET)_pic.$(LIBEXT) -endif -endif -ifdef BIN_TARGET - -rm -f $(BIN_DIR)/$(BIN_TARGET) -endif - -clean_links: - -### -# -# Dist clean -# -_distclean: _tidy - rm -rf $(DEPDIR) $(PIC_DIR) $(PIC_TMP_DIR) $(SO_TMP_DIR) $(A_TMP_DIR) Sources build.spec - -### -# -# tidy -# -_tidy: _cleanall _clean_dep - -rm -f *~ *.$(OBJEXT) *.$(LIBEXT) *.${SHLIBEXT} - -# -# clean cleanall tidy - recursion -# -ifeq ($(findstring clean,$(replace-targets)),) -clean: _clean $(patsubst %, _clean_%, $(A_DIRS)) -endif - -$(patsubst %, _clean_%, $(A_DIRS)) : DUMMY - $(MAKE) -C $(patsubst _clean_%,%,$@) clean - -cleanall: _cleanall $(patsubst %, _cleanall_%, $(A_DIRS)) - -$(patsubst %, _cleanall_%, $(A_DIRS)) : DUMMY - $(MAKE) -C $(patsubst _cleanall_%,%,$@) cleanall - -tidy: _tidy $(patsubst %, _tidy_%, $(A_DIRS)) - -$(patsubst %, _tidy_%, $(A_DIRS)) : DUMMY - $(MAKE) -C $(patsubst _tidy_%,%,$@) tidy - -distclean: _distclean $(patsubst %, _distclean_%, $(A_DIRS)) - -$(patsubst %, _distclean_%, $(A_DIRS)) : DUMMY - $(MAKE) -C $(patsubst _distclean_%,%,$@) distclean - -### -# -# Guess configuration - -$(NDB_TOP)/config/config.mk: $(NDB_TOP)/config/GuessConfig.sh - $(NDB_TOP)/config/GuessConfig.sh -D - -$(NDB_TOP)/config/Defs....mk: $(NDB_TOP)/config/config.mk -$(NDB_TOP)/config/Defs..mk: $(NDB_TOP)/config/config.mk - -### -# Soft ose envirment stuff -# -osemain.con: $(NDB_TOP)/src/env/softose/osemain_con.org - cp $< $@ - echo "PRI_PROC(init_$(BIN_TARGET), init_$(BIN_TARGET), 65535, 3, ndb, 0, NULL)" >> $@ - -osemain.c: $(OSE_LOC)/sfk-solaris2/krn-solaris2/src/osemain.c - ln -s $< $@ - -osemain.o : osemain.con - -$(DEPDIR)/osemain.d : osemain.con - -### -# -# These target dont want dependencies - -NO_DEP=clean clobber cleanall tidy clean_dep $(DEPDIR) build_spec \ - $(NDB_TOP)/config/config.mk distclean osemain.con osemain.c - -ifeq ($(filter $(NO_DEP), $(MAKECMDGOALS)),) -ifneq ($(strip $(DEPENDENCIES)),) - include $(DEPMK) -endif -endif - -### -# -# Auxiliary targets - -sources: Sources - -Sources: Makefile - @rm -f $@ - @for f in Makefile $(A_DIRS) $(SOURCES) $(SOURCES.c); do echo $$f; done >$@ - -### -# -# TAG generation for emacs and vi folks -# -# In emacs "Esc- ." or "M- ." to find a symbol location -# In vi use the :\tag command -# by convention: -# TAGS is used with emacs -# tags is used with vi -# -# Hopefully the make is being done from $(NDB_TOP)/src -# and your TAGS/tags file then is in the same directory. - -TAGS: DUMMY - rm -f TAGS - find $(NDB_TOP) -name "*.[ch]" | xargs $(ETAGS) --append - find $(NDB_TOP) -name "*.[ch]pp" | xargs $(ETAGS) --append - -tags: DUMMY - rm -f tags - find $(NDB_TOP) -name "*.[ch]" | xargs $(CTAGS) --append - find $(NDB_TOP) -name "*.[ch]pp" | xargs $(CTAGS) --append - -install: - - -ebrowse: DUMMY - cd $(NDB_TOP); rm -f EBROWSE - cd $(NDB_TOP); find . -name "*.hpp" -or -name "*.cpp" -or -name "*.h" -or -name "*.c" > tmpfile~ - cd $(NDB_TOP); ebrowse --file tmpfile~ - cd $(NDB_TOP); rm -f tmpfile~ - -srcdir = $(NDB_TOP) -top_distdir = $(NDB_TOP)/.. -mkinstalldirs := /bin/sh ../mkinstalldirs -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)/ndb - -distdir: - $(mkinstalldirs) $(distdir) - @list='$(shell /bin/sh SrcDist.sh)'; for file in $$list; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -f $$d/$$file; then \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done diff --git a/ndb/Makefile.am b/ndb/Makefile.am index 27274ec1eb2..5cd52010f1d 100644 --- a/ndb/Makefile.am +++ b/ndb/Makefile.am @@ -1,39 +1,13 @@ -SUBDIRS = src test tools . +SUBDIRS = src tools . include $(ndb_opt_test_subdirs) +EXTRA_DIST = config -ndbinclude_HEADERS = \ -include/ndb_types.h \ -include/ndb_version.h - -ndbapiinclude_HEADERS = \ -include/ndbapi/ndbapi_limits.h \ -include/ndbapi/Ndb.hpp \ -include/ndbapi/NdbApi.hpp \ -include/ndbapi/NdbConnection.hpp \ -include/ndbapi/NdbCursorOperation.hpp \ -include/ndbapi/NdbDictionary.hpp \ -include/ndbapi/NdbError.hpp \ -include/ndbapi/NdbEventOperation.hpp \ -include/ndbapi/NdbIndexOperation.hpp \ -include/ndbapi/NdbOperation.hpp \ -include/ndbapi/NdbPool.hpp \ -include/ndbapi/NdbRecAttr.hpp \ -include/ndbapi/NdbReceiver.hpp \ -include/ndbapi/NdbResultSet.hpp \ -include/ndbapi/NdbScanFilter.hpp \ -include/ndbapi/NdbScanOperation.hpp \ -include/ndbapi/NdbSchemaCon.hpp \ -include/ndbapi/NdbSchemaOp.hpp - -mgmapiinclude_HEADERS = \ -include/mgmapi/mgmapi.h \ -include/mgmapi/mgmapi_debug.h - -EXTRA_DIST = include +include $(top_srcdir)/ndb/config/common.mk.am dist-hook: -rm -rf `find $(distdir) -type d -name SCCS` + -rm -rf `find $(distdir) -type d -name old_files` list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" != "."; then \ + if test "$$subdir" != "." -a "$$subdir" != "include"; then \ files="`find $$subdir -name '*\.h'` `find $$subdir -name '*\.hpp'`"; \ for f in $$files; do \ if test -d "$(distdir)/`dirname $$f`" -a ! -e "$(distdir)/$$f"; then \ diff --git a/ndb/Makefile_old b/ndb/Makefile_old deleted file mode 100644 index 8788eae885d..00000000000 --- a/ndb/Makefile_old +++ /dev/null @@ -1,69 +0,0 @@ -include .defs.mk - -DIRS := src test tools examples - -# hack before full autoconf -replace-targets := all clean -NDB_RELEASE := $(shell ../scripts/mysql_config --version) - -all: - $(MAKE) -j 1 -C src - $(MAKE) -j 1 -C test/src - $(MAKE) -j 1 -C tools - $(MAKE) -j 1 -C test/ndbapi/flexBench - $(MAKE) -j 1 -C test/tools/waiter - -include $(NDB_TOP)/Epilogue.mk - -_libs_test : _bins_src -_libs_tools : _libs_test -_libs_examples : _bins_src -_bins_src : _libs_src -_bins_tools : _bins_src - -# always release compile except for ndbapi static lib -old-all: - $(MAKE) -C src/ndbapi libs - $(MAKE) libs NDB_VERSION=RELEASE - $(MAKE) bins NDB_VERSION=RELEASE -ifeq ($(NDB_OS),LINUX) - NDB_RELEASE=$(NDB_RELEASE) $(MAKE) -j1 -C docs all cd /home/bk/mysql-4.1-ndb -shell> BUILD/compile-pentium-debug -c --prefix=/usr/local/mysql-4.1-ndb -shell> make - diff --git a/ndb/SrcDist.sh b/ndb/SrcDist.sh deleted file mode 100644 index 03e697b1475..00000000000 --- a/ndb/SrcDist.sh +++ /dev/null @@ -1,87 +0,0 @@ -# -# Invoked from make distdir. -# Prints list of dirs and files to include under mysql/ndb. -# - -# top dir - -grep -v '^#' <<__END__ -#ReleaseNotes.html -.defs.mk -Defs.mk -configure -Makefile -Epilogue.mk -SrcDist.sh -BinDist.sh -mysqlclusterenv.sh -__END__ - -# subset of bins, libs - -grep -v '^#' <<__END__ -bin/ -bin/mysqlcluster -bin/mysqlcluster_install_db -bin/mysqlclusterd -lib/ -__END__ - -# docs - -#find docs/*.html docs/*.pdf -print - -# include - -find include -print | grep -v /SCCS - -# config - -find config -print | grep -v /SCCS - -# tools - -find tools -print | grep -v /SCCS | grep -v '\.o' | grep -v '\.depend' | grep -v tools/ndbsql - -# home - -find home -print | grep -v /SCCS - -# test - -find test -print | grep -v /SCCS | grep -v '\.o' | grep -v '\.depend' | grep -v test/odbc - -# src - -find src -print | grep -v /SCCS | grep -v '\.o' | grep -v '\.depend' | grep -v src/client/odbc | grep -v cpcc-win32 - -# demos - -find demos -print | grep -v /SCCS | grep -v '\.o' | grep -v '\.depend' - -# examples - -grep -v '^#' <<__END__ -examples/ -examples/Makefile -examples/ndbapi_example1/ -examples/ndbapi_example1/Makefile -examples/ndbapi_example1/ndbapi_example1.cpp -examples/ndbapi_example2/ -examples/ndbapi_example2/Makefile -examples/ndbapi_example2/ndbapi_example2.cpp -examples/ndbapi_example3/ -examples/ndbapi_example3/Makefile -examples/ndbapi_example3/ndbapi_example3.cpp -examples/ndbapi_example4/ -examples/ndbapi_example4/Makefile -examples/ndbapi_example4/ndbapi_example4.cpp -examples/ndbapi_example5/ -examples/ndbapi_example5/Makefile -examples/ndbapi_example5/ndbapi_example5.cpp -examples/select_all/ -examples/select_all/Makefile -examples/select_all/select_all.cpp -__END__ - -exit 0 diff --git a/ndb/config/Defs.DEBUG.mk b/ndb/config/Defs.DEBUG.mk deleted file mode 100644 index 309ae90a0ba..00000000000 --- a/ndb/config/Defs.DEBUG.mk +++ /dev/null @@ -1,4 +0,0 @@ - -VERSION_FLAGS := -DNDB_DEBUG -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD -#-DDEBUG_TRANSPORTER - diff --git a/ndb/config/Defs.HPUX.HPPA.GCC.mk b/ndb/config/Defs.HPUX.HPPA.GCC.mk deleted file mode 100644 index 895c7672071..00000000000 --- a/ndb/config/Defs.HPUX.HPPA.GCC.mk +++ /dev/null @@ -1,50 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - -C++ := g++ -CC := gcc -AR_RCS := ar rcs -SO := ld -b -o - -SHLIBEXT := sl - -MAKEDEPEND := g++ -M -PIC := -fPIC - -RPCGENFLAGS := -MA -C -N -ETAGS := etags -CTAGS := ctags - -### -# -# Flags -# -CCFLAGS_WARNINGS = -Wno-long-long -W -Wall -pedantic -# -Wno-sign-compare Use this flag if you are annoyed with all the warnings -CCFLAGS_TOP = -DHPUX -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DNO_COMMAND_HANDLER - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -g -else -VERSION_FLAGS += -g -endif -endif - -CCFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) -CFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) - -LDFLAGS_TOP = -lpthread -lnsl -lrt - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(C++) $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) - diff --git a/ndb/config/Defs.IBMAIX.POWERPC.GCC.mk b/ndb/config/Defs.IBMAIX.POWERPC.GCC.mk deleted file mode 100644 index ae975fb2cb8..00000000000 --- a/ndb/config/Defs.IBMAIX.POWERPC.GCC.mk +++ /dev/null @@ -1,49 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - -C++ := g++ -CC := gcc -AR_RCS := $(PURE) ar rcs -SO := g++ -shared -o - -MAKEDEPEND := g++ -M -PIC := -fPIC - -RPCGENFLAGS := -M -C -N - -ETAGS := etags -CTAGS := ctags - -### -# -# Flags -# -CCFLAGS_WARNINGS = -Wno-long-long -Wall #-pedantic -# Add these for more warnings -Weffc++ -W -CCFLAGS_TOP = -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -CCFLAGS_TOP += -fno-rtti - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -g -else -VERSION_FLAGS += -g -endif -endif - -CCFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) -CFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) - -LDFLAGS_TOP = -lpthread -lrt - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(C++) $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) diff --git a/ndb/config/Defs.LINUX.x86.GCC.mk b/ndb/config/Defs.LINUX.x86.GCC.mk deleted file mode 100644 index 6167a30ff23..00000000000 --- a/ndb/config/Defs.LINUX.x86.GCC.mk +++ /dev/null @@ -1,60 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - -C++ := gcc$(GCC_VERSION) -CC := gcc$(GCC_VERSION) -AR_RCS := $(PURE) ar rcs -SO := gcc$(GCC_VERSION) -shared -lpthread -o -#SO := gcc$(GCC_VERSION) -shared -o - -MAKEDEPEND := gcc$(GCC_VERSION) -M -#MAKEDEPEND := gcc$(GCC_VERSION) -M -nostdinc -nostdinc++ -PIC := -fPIC - -RPCGENFLAGS := -M -C -N - -ETAGS := etags -CTAGS := ctags - -### -# -# Flags -# -# gcc3.3 __THROW problem if -pedantic and -O2 -ifeq ($(NDB_VERSION),DEBUG) -CCFLAGS_WARNINGS = -Wno-long-long -Wall -pedantic -else -CCFLAGS_WARNINGS = -Wno-long-long -Wall -endif -# Add these for more warnings -Weffc++ -W -CCFLAGS_TOP = -#CCFLAGS_TOP = -DSAFE_MUTEX -CCFLAGS_TOP += -fno-rtti -fno-exceptions - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -O2 -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -O2 -g -else -VERSION_FLAGS += -g -endif -endif - -CCFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) -CFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) - -LDFLAGS_TOP = - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(CC) $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) - -LDFLAGS_LAST = -lrt -lpthread $(NDB_TOP)/src/common/portlib/gcc.cpp -#LDFLAGS_LAST = -lrt $(NDB_TOP)/src/common/portlib/gcc.cpp $(NDB_TOP)/../mysys/libmysys.a $(NDB_TOP)/../dbug/libdbug.a $(NDB_TOP)/../regex/libregex.a $(NDB_TOP)/../strings/libmystrings.a -lpthread diff --git a/ndb/config/Defs.LINUX.x86.ICC.mk b/ndb/config/Defs.LINUX.x86.ICC.mk deleted file mode 100644 index 8e8540409da..00000000000 --- a/ndb/config/Defs.LINUX.x86.ICC.mk +++ /dev/null @@ -1,54 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - -C++ := icc -CC := icc -AR_RCS := $(PURE) ar rcs -SO := g++$(GCC_VERSION) -shared -lpthread -o - -MAKEDEPEND := g++$(GCC_VERSION) -M -PIC := -fPIC - -RPCGENFLAGS := -M -C -N - -ETAGS := etags -CTAGS := ctags - -### -# -# Flags -# -# gcc3.3 __THROW problem if -pedantic and -O2 -ifeq ($(NDB_VERSION),DEBUG) -CCFLAGS_WARNINGS = -else -CCFLAGS_WARNINGS = -endif -# Add these for more warnings -Weffc++ -W -CCFLAGS_TOP = -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -CCFLAGS_TOP += - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -O2 -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -O2 -g -else -VERSION_FLAGS += -g -endif -endif - -CCFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) -CFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) - -LDFLAGS_TOP = -lpthread -lrt - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(C++) $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) diff --git a/ndb/config/Defs.LINUX.x86_64.GCC.mk b/ndb/config/Defs.LINUX.x86_64.GCC.mk deleted file mode 100644 index a238d29ef4c..00000000000 --- a/ndb/config/Defs.LINUX.x86_64.GCC.mk +++ /dev/null @@ -1,54 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - -C++ := g++ -CC := gcc -AR_RCS := $(PURE) ar rcs -SO := g++ -shared -lpthread -o - -MAKEDEPEND := g++ -M -PIC := -fPIC - -RPCGENFLAGS := -M -C -N - -ETAGS := etags -CTAGS := ctags - -### -# -# Flags -# -# gcc3.3 __THROW problem if -pedantic and -O2 -ifeq ($(NDB_VERSION),DEBUG) -CCFLAGS_WARNINGS = -Wno-long-long -Wall -pedantic -else -CCFLAGS_WARNINGS = -Wno-long-long -Wall -endif -# Add these for more warnings -Weffc++ -W -CCFLAGS_TOP = -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -CCFLAGS_TOP += -fno-rtti -fno-exceptions -m64 - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -O2 -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -O2 -g -else -VERSION_FLAGS += -g -endif -endif - -CCFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) -CFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) - -LDFLAGS_TOP = -lpthread -lrt - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(C++) $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) diff --git a/ndb/config/Defs.MACOSX.POWERPC.GCC.mk b/ndb/config/Defs.MACOSX.POWERPC.GCC.mk deleted file mode 100644 index bb73e9bcc61..00000000000 --- a/ndb/config/Defs.MACOSX.POWERPC.GCC.mk +++ /dev/null @@ -1,58 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - -C++ := gcc -CC := gcc -CXX := gcc -AR_RCS := $(PURE) ar rcs -#SO := g++ -dynamiclib -Wl,-segprot,__TEXT,rwx,rwx -o -SO := gcc -dynamiclib -o - -SHLIBEXT := dylib - -MAKEDEPEND := gcc -M -PIC := -fPIC - -RPCGENFLAGS := -M -C -N - -ETAGS := etags -CTAGS := ctags - -### -# -# Flags -# -CCFLAGS_WARNINGS = -Wno-long-long -Wall -Winline #-Werror#-pedantic -# Add these for more warnings -Weffc++ -W -CCFLAGS_TOP = -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_BIG_ENDIAN -CXX_FLAGS_TOP = -fno-rtti -felide-constructors -fno-exceptions -fno-omit-fram-pointer -C_FLAGS_TOP += -fno-omit-frame-pointer - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -g -else -VERSION_FLAGS += -g -endif -endif - -CCFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(CXXFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) -CFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(C_FLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) - -LDFLAGS_TOP = - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(C++) $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) - -#LDFLAGS_LAST = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -LDFLAGS_LAST = -lstdc++ - diff --git a/ndb/config/Defs.OSE.PPC750.DIAB.mk b/ndb/config/Defs.OSE.PPC750.DIAB.mk deleted file mode 100644 index 8773021a152..00000000000 --- a/ndb/config/Defs.OSE.PPC750.DIAB.mk +++ /dev/null @@ -1,47 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - -C++ := dplus -CC := dcc -AR_RCS := $(PURE) ar rcs -SO := dar -r - -MAKEDEPEND := g++ -M -nostdinc -PIC := - -RPCGENFLAGS := -MA -C -N - -### -# -# Flags -# -CCFLAGS_INCLUDE = -I/vobs/cello/cls/rtosi_if/include -I/vobs/cello/cls/rtosi_if/include.mp750 -I/vobs/cello/cls/rtosi_if/include.ppc -CCFLAGS_TOP = -tPPC750EH -DBIG_ENDIAN -D_BIG_ENDIAN -DPPC -DPPC750 -DOSE_DELTA -DMP -Xlint -Xforce-prototypes -DINLINE=__inline__ -Xansi -Xsmall-data=0 -Xsmall-const=0 -Xstrings-in-text - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -XO -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -XO -g -else -VERSION_FLAGS += -g -endif -endif - -CCFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_INCLUDE) -CFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_INCLUDE) - -LDFLAGS_TOP = - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(C++) $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) - - - diff --git a/ndb/config/Defs.RELEASE.mk b/ndb/config/Defs.RELEASE.mk deleted file mode 100644 index fad72d53a43..00000000000 --- a/ndb/config/Defs.RELEASE.mk +++ /dev/null @@ -1,3 +0,0 @@ - -VERSION_FLAGS := -DNDB_RELEASE -DUSE_EMULATED_JAM -DNDEBUG - diff --git a/ndb/config/Defs.RELEASE_TRACE.mk b/ndb/config/Defs.RELEASE_TRACE.mk deleted file mode 100644 index 06726f282e4..00000000000 --- a/ndb/config/Defs.RELEASE_TRACE.mk +++ /dev/null @@ -1,3 +0,0 @@ - -VERSION_FLAGS := -DNDB_RELEASE -DUSE_EMULATED_JAM -DNDEBUG -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD - diff --git a/ndb/config/Defs.SIMCELLO.SOFTOSE.GCC.mk b/ndb/config/Defs.SIMCELLO.SOFTOSE.GCC.mk deleted file mode 100644 index 8d73e7a752b..00000000000 --- a/ndb/config/Defs.SIMCELLO.SOFTOSE.GCC.mk +++ /dev/null @@ -1,53 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - -C++ := g++ -CC := gcc -AR_RCS := $(PURE) ar rcs -SO := g++ -shared -o - -MAKEDEPEND := g++ -M -PIC := -fPIC - -### -# -# Flags -# -NDB_STRDUP := Y -CCFLAGS_WARNINGS = -Wall -pedantic -Wno-sign-compare -CC_FLAGS_OSE = -DSPARC -DSIM -DOSE_DELTA -DMP -CCFLAGS_TOP = $(CC_FLAGS_OSE) $(CC_FLAGS_WARNINGS) -DNDB_STRDUP - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -g -else -VERSION_FLAGS += -g -endif -endif - - -CCFLAGS_LOC_OSE= -I/vobs/cello/cls/rtosi_if/include.sparc - - -CCFLAGS = $(CCFLAGS_LOC_OSE) $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) -CFLAGS = $(CCFLAGS_LOC_OSE) $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) - -LDLIBS_LOC = -L$(NDB_TOP)/lib -L$(OSE_LOC)/sfk-solaris2/lib -L$(OSE_LOC)/sfk-solaris2/krn-solaris2/lib - -LDLIBS_TOP = - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(C++) $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(LDFLAGS) - - - diff --git a/ndb/config/Defs.SOFTOSE.SPARC.GCC.mk b/ndb/config/Defs.SOFTOSE.SPARC.GCC.mk deleted file mode 100644 index 6788fa956bf..00000000000 --- a/ndb/config/Defs.SOFTOSE.SPARC.GCC.mk +++ /dev/null @@ -1,57 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - -C++ := g++ -CC := gcc -AR_RCS := $(PURE) ar rcs -SO := g++ -shared -o - -MAKEDEPEND := g++ -M -PIC := -fPIC - -### -# -# Flags -# -NDB_STRDUP := Y -CCFLAGS_WARNINGS = -Wno-long-long -Wall -pedantic -Wno-sign-compare -ansi -CC_FLAGS_OSE = -DUSE_OSEDEF_H -DOSE_DELTA -DOS_DEBUG -DBIG_ENDIAN -CCFLAGS_TOP = $(CC_FLAGS_OSE) $(CC_FLAGS_WARNINGS) -DNDB_STRDUP - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -g -else -VERSION_FLAGS += -g -DOS_DEBUG -endif -endif - -OSE_LOC = /opt/as/OSE/OSE4.3.1 - -CCFLAGS_LOC_OSESTD = -I$(OSE_LOC)/sfk-solaris2/std-include -CCFLAGS_LOC_OSE = -I$(OSE_LOC)/sfk-solaris2/include -I$(OSE_LOC)/sfk-solaris2/krn-solaris2/include -I$(NDB_TOP)/src/env/softose - - -CCFLAGS = $(CCFLAGS_LOC_OSE) $(CCFLAGS_LOC_OSESTD) $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) -CFLAGS = $(CCFLAGS_LOC_OSE) $(CCFLAGS_LOC_OSESTD) $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) - -LDLIBS_LOC = -L$(NDB_TOP)/lib -L$(OSE_LOC)/sfk-solaris2/lib -L$(OSE_LOC)/sfk-solaris2/krn-solaris2/lib - -LDLIBS_TOP = - -LDLIBS_LAST = -lsoftose_env -lsoftose_krn -llnh -lefs -lshell -lfss -ltosv -lrtc -lheap -linetutil -linetapi -lsoftose -lsoftose_env -lsoftose_krn -losepthread -lrtc -lnsl -lsocket -lpthread -lcrt -lm - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(C++) $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(LDFLAGS) - - - diff --git a/ndb/config/Defs.SOLARIS.SPARC.FORTE6.mk b/ndb/config/Defs.SOLARIS.SPARC.FORTE6.mk deleted file mode 100644 index 8a95205703d..00000000000 --- a/ndb/config/Defs.SOLARIS.SPARC.FORTE6.mk +++ /dev/null @@ -1,54 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - -C++ := CC -CC := /opt/as/forte6/SUNWspro/bin/cc -AR_RCS := $(PURE) CC -xar -o -SO := CC -G -z text -o - -MAKEDEPEND := CC -xM1 -PIC := -KPIC -ETAGS := etags -CTAGS := ctags - -RPCGENFLAGS := -MA -C -N - -### -# -# Flags - -CCFLAGS_TOP = -mt -DSOLARIS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS - -ifneq ($(PURE),) - CCFLAGS_TOP += -xs - CCFLAGS_TOP += -DNDB_PURIFY -endif - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -xO3 -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -xO3 -g -else -VERSION_FLAGS += -g -endif -endif - -CCFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) -CFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) - -LDFLAGS_TOP = -L/opt/as/forte6/SUNWspro/WS6/lib -lpthread -lsocket -lnsl -lrt - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(C++) -xildoff $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) - - - - diff --git a/ndb/config/Defs.SOLARIS.SPARC.GCC.mk b/ndb/config/Defs.SOLARIS.SPARC.GCC.mk deleted file mode 100644 index 25920515278..00000000000 --- a/ndb/config/Defs.SOLARIS.SPARC.GCC.mk +++ /dev/null @@ -1,54 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - -CXX := gcc -C++ := g++ -CC := gcc -AR_RCS := ar rcs -SO := gcc -G -o - -#GXX_VERSION := $(shell gcc --version | sed -e 's,.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*,\1,1' -e q) - -MAKEDEPEND := g++ -M -PIC := -fPIC - -RPCGENFLAGS := -MA -C -N -ETAGS := etags -CTAGS := ctags - -### -# -# Flags -# -CCFLAGS_WARNINGS = -Wno-long-long -W -Wall -pedantic -# -Wno-sign-compare Use this flag if you are annoyed with all the warnings -CCFLAGS_TOP = -DSOLARIS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DNO_COMMAND_HANDLER -CCFLAGS_TOP += -fno-rtti - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -O2 -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -O2 -g -else -VERSION_FLAGS += -g -endif -endif - -CCFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) -CFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) - -LDFLAGS_TOP = - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(CXX) $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) - -LDFLAGS_LAST = -lpthread -lsocket -lnsl -lrt -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic - diff --git a/ndb/config/Defs.SOLARIS.SPARC_64.GCC.mk b/ndb/config/Defs.SOLARIS.SPARC_64.GCC.mk deleted file mode 100644 index 2b8b9d4cc24..00000000000 --- a/ndb/config/Defs.SOLARIS.SPARC_64.GCC.mk +++ /dev/null @@ -1,53 +0,0 @@ -### -# -# Note: LD_LIBRARY_PATH must be set for /usr/local/lib/sparcv9 to dynamically link -# to 64-bit libraries -# -# Defines -SHELL := /bin/sh - -C++ := g++ -m64 -CC := gcc -m64 -AR_RCS := ar rcs -SO := g++ -m64 -shared -o - -MAKEDEPEND := g++ -M -PIC := -fPIC - -RPCGENFLAGS := -MA -C -N -ETAGS := etags -CTAGS := ctags - -### -# -# Flags -# -CCFLAGS_WARNINGS = -Wno-long-long -W -Wall -pedantic -# -Wno-sign-compare Use this flag if you are annoyed with all the warnings -CCFLAGS_TOP = -DSOLARIS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DNO_COMMAND_HANDLER -CCFLAGS_TOP += -fno-rtti - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -O2 -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -O2 -g -else -VERSION_FLAGS += -g -endif -endif - -CCFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) -CFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) - -LDFLAGS_TOP = -lpthread -lsocket -lnsl -lrt - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(C++) $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) - - diff --git a/ndb/config/Defs.SOLARIS6.SPARC.GCC.mk b/ndb/config/Defs.SOLARIS6.SPARC.GCC.mk deleted file mode 100644 index f1c570ba101..00000000000 --- a/ndb/config/Defs.SOLARIS6.SPARC.GCC.mk +++ /dev/null @@ -1,53 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - -C++ := g++ -CC := gcc -AR_RCS := $(PURE) ar rcs -SO := g++ -shared -o - -MAKEDEPEND := g++ -M -PIC := -fPIC - -RPCGENFLAGS := -MA -C -N - -### -# -# Flags -# -CCFLAGS_WARNINGS = -Wno-long-long -Wall -pedantic -# -Wno-sign-compare Use this flag if you are annoyed with all the warnings -CCFLAGS_TOP = -DSOLARIS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DNO_COMMAND_HANDLER - -# SOLARIS 6 should use the same settings as SOLARIS7 -# if something in the SOLARIS 7 port does not work for SOLARIS 6 -# it can be ifdefed using -# if ! defined NDB_SOLRIS6 -CCFLAGS_TOP = -DNDB_SOLARIS - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -else -VERSION_FLAGS += -g -endif -endif - -CCFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) -CFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) - -LDFLAGS_TOP = -lpthread -lsocket -lnsl -lposix4 - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(C++) $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) - - diff --git a/ndb/config/Defs.TRU64X.ALPHA.GCC.mk b/ndb/config/Defs.TRU64X.ALPHA.GCC.mk deleted file mode 100644 index ae975fb2cb8..00000000000 --- a/ndb/config/Defs.TRU64X.ALPHA.GCC.mk +++ /dev/null @@ -1,49 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - -C++ := g++ -CC := gcc -AR_RCS := $(PURE) ar rcs -SO := g++ -shared -o - -MAKEDEPEND := g++ -M -PIC := -fPIC - -RPCGENFLAGS := -M -C -N - -ETAGS := etags -CTAGS := ctags - -### -# -# Flags -# -CCFLAGS_WARNINGS = -Wno-long-long -Wall #-pedantic -# Add these for more warnings -Weffc++ -W -CCFLAGS_TOP = -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -CCFLAGS_TOP += -fno-rtti - -ifeq (RELEASE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -VERSION_FLAGS += -O3 -g -else -VERSION_FLAGS += -g -endif -endif - -CCFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) -CFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) - -LDFLAGS_TOP = -lpthread -lrt - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -LINK.cc = $(PURE) $(C++) $(CCFLAGS) $(LDFLAGS) - -LINK.c = $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) diff --git a/ndb/config/Defs.WIN32.x86.VC7.mk b/ndb/config/Defs.WIN32.x86.VC7.mk deleted file mode 100644 index e66dacb78e7..00000000000 --- a/ndb/config/Defs.WIN32.x86.VC7.mk +++ /dev/null @@ -1,61 +0,0 @@ -### -# -# Defines -SHELL := /bin/sh - - -DEFINES = -D_WIN32 -D_M_IX86=600 -D_MSC_EXTENSIONS=0 -U_cdecl -D_MT -# -MAKEDEPEND = g++ -M --nostdinc --nostdinc++ -I"`cygpath -u "$(MSVCDIR)\include"`" -I"`cygpath -u "$(MSVCDIR)\PlatformSDK\include"`" $(DEFINES) -PIC = -D_LIB -NON_PIC = -D_LIB - -RPCGENFLAGS := -M -C -N - -ETAGS := etags -CTAGS := ctags - -### -# -# Flags -# -CCFLAGS_WARNINGS = -CCFLAGS_TOP = -CCFLAGS_LOC = -CCFLAGS_WIN = -DWIN32 -D_WIN32_WINNT=0x0500 -DWINVER=0x0500 -D_MBCS -DNO_COMMAND_HANDLER -CCFLAGS_WIN += -W3 -EHsc -#CCFLAGS_WIN += -clr - -ifeq (RELEASE, $(NDB_VERSION)) -CCFLAGS_WIN += -MT -O2 -Ob1 -DNO_DEBUG_MESSAGES -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -CCFLAGS_WIN += -MT -O2 -Ob1 -DNO_DEBUG_MESSAGES -else -CCFLAGS_WIN += -MTd -Zi -Od -GS -D_DEBUG -endif -endif - -C++ = cl -nologo $(CCFLAGS_WIN) -CC = cl -nologo $(CCFLAGS_WIN) - -CCFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) -CFLAGS = $(CCFLAGS_LOC) $(CCFLAGS_TOP) $(USER_FLAGS) $(VERSION_FLAGS) $(CCFLAGS_WARNINGS) - -LDFLAGS_TOP = - -LDFLAGS = $(LDFLAGS_LOC) $(LDFLAGS_TOP) - -LDLIBS = $(LDLIBS_LOC) $(LDLIBS_TOP) - -WIN_LIBS := Ws2_32.lib Advapi32.lib - -ifeq (RELEASE, $(NDB_VERSION)) -LINK.cc = link -INCREMENTAL:NO -NOLOGO -LARGEADDRESSAWARE $(WIN_LIBS) -else -ifeq (RELEASE_TRACE, $(NDB_VERSION)) -LINK.cc = link -INCREMENTAL:NO -NOLOGO -LARGEADDRESSAWARE $(WIN_LIBS) -else -LINK.cc = link -INCREMENTAL -NOLOGO -DEBUG -LARGEADDRESSAWARE $(WIN_LIBS) -endif -endif diff --git a/ndb/config/GuessConfig.sh_old b/ndb/config/GuessConfig.sh_old deleted file mode 100755 index 8c7886401ba..00000000000 --- a/ndb/config/GuessConfig.sh_old +++ /dev/null @@ -1,116 +0,0 @@ -#! /bin/sh - -if [ -z "$NDB_TOP" ] -then - echo "You have not set NDB_TOP. Exiting" 1>&2 - exit 1 -fi - -if [ -z "$NDB_SCI" ] -then - NDB_SCI=N -fi - -if [ -z "$NDB_SHM" ] -then - NDB_SHM=N -fi - -os=`uname -s` -case $os in -Linux) - NDB_OS=LINUX - NDB_ARCH=x86 - NDB_COMPILER=GCC - ;; -Darwin) - NDB_OS=MACOSX - NDB_ARCH=POWERPC - NDB_COMPILER=GCC - ;; -HP-UX) - NDB_OS=HPUX - NDB_ARCH=HPPA - NDB_COMPILER=GCC - ;; -CYGWIN_NT-5.0) - NDB_OS=WIN32 - NDB_ARCH=x86 - NDB_COMPILER=VC7 - ;; -*) - if [ "$os" = "SunOS" ] && [ `uname -r` = "5.6" ] - then - NDB_OS=OSE - NDB_ARCH=PPC750 - NDB_COMPILER=DIAB - else - NDB_OS=SOLARIS - NDB_ARCH=SPARC - NDB_COMPILER=GCC - fi;; -esac - -if [ -z "$NDB_ODBC" ] -then - NDB_ODBC=N -fi - - -mch=`uname -m` -case $mch in -x86_64) - NDB_ARCH=x86_64 - ;; -*) - ;; -esac - -if [ -f $NDB_TOP/config/Makefile ] -then -TERMCAP_LIB=`grep TERMCAP_LIB $NDB_TOP/config/Makefile | sed -e s,"TERMCAP_LIB.*=.*-l","",g` -fi -if [ "$TERMCAP_LIB" = "" ] -then -TERMCAP_LIB=termcap -fi - -# defaults -NDB_VERSION=DEBUG -PACKAGE= -VERSION= - -parse_arguments() { - for arg do - case "$arg" in - -GCC) NDB_COMPILER=GCC ;; - -R) NDB_VERSION=RELEASE ;; - -D) NDB_VERSION=DEBUG ;; - --PACKAGE=*) PACKAGE=`echo "$arg" | sed -e "s;--PACKAGE=;;"` ;; - --VERSION=*) VERSION=`echo "$arg" | sed -e "s;--VERSION=;;"` ;; - *) - echo "Unknown argument '$arg'" - exit 1 - ;; - esac - done -} - -parse_arguments "$@" - -( - echo "# This file was automatically generated `date`" - echo "NDB_OS := $NDB_OS" - echo "NDB_ARCH := $NDB_ARCH" - echo "NDB_COMPILER := $NDB_COMPILER" - echo "NDB_VERSION := $NDB_VERSION" - echo "NDB_SCI := $NDB_SCI" - echo "NDB_SHM := $NDB_SHM" - echo "NDB_ODBC := $NDB_ODBC" - echo "TERMCAP_LIB := $TERMCAP_LIB" - echo "PACKAGE := $PACKAGE" - echo "VERSION := $VERSION" -) > $NDB_TOP/config/config.mk - -exit 0 - diff --git a/ndb/config/Makefile.am_old b/ndb/config/Makefile.am_old deleted file mode 100644 index b5fd81814a1..00000000000 --- a/ndb/config/Makefile.am_old +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2003 MySQL AB -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -# Process this file with automake to create Makefile.in - -AUTOMAKE_OPTIONS = foreign - -# These are built from source in the Docs directory -EXTRA_DIST = -SUBDIRS = - -# Relink after clean -linked_sources = - -CLEANFILES = $(linked_sources) - -# This is just so that the linking is done early. -config.h: diff --git a/ndb/config/acinclude.m4 b/ndb/config/acinclude.m4 deleted file mode 100644 index b9edaf801ed..00000000000 --- a/ndb/config/acinclude.m4 +++ /dev/null @@ -1,1513 +0,0 @@ -# Local macros for automake & autoconf - -AC_DEFUN(MYSQL_CHECK_LIBEDIT_INTERFACE,[ - AC_CACHE_CHECK([libedit variant of rl_completion_entry_function], mysql_cv_libedit_interface, - AC_TRY_COMPILE( - [ - #include "stdio.h" - #include "readline/readline.h" - ], - [ - char res= *(*rl_completion_entry_function)(0,0); - completion_matches(0,0); - ], - [ - mysql_cv_libedit_interface=yes - AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE) - ], - [mysql_cv_libedit_interface=no] - ) - ) -]) - -AC_DEFUN(MYSQL_CHECK_NEW_RL_INTERFACE,[ - AC_CACHE_CHECK([defined rl_compentry_func_t and rl_completion_func_t], mysql_cv_new_rl_interface, - AC_TRY_COMPILE( - [ - #include "stdio.h" - #include "readline/readline.h" - ], - [ - rl_completion_func_t *func1= (rl_completion_func_t*)0; - rl_compentry_func_t *func2= (rl_compentry_func_t*)0; - ], - [ - mysql_cv_new_rl_interface=yes - AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE) - ], - [mysql_cv_new_rl_interface=no] - ) - ) -]) - -# A local version of AC_CHECK_SIZEOF that includes sys/types.h -dnl MYSQL_CHECK_SIZEOF(TYPE [, CROSS-SIZE]) -AC_DEFUN(MYSQL_CHECK_SIZEOF, -[changequote(<<, >>)dnl -dnl The name to #define. -define(<>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl -dnl The cache variable name. -define(<>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl -changequote([, ])dnl -AC_MSG_CHECKING(size of $1) -AC_CACHE_VAL(AC_CV_NAME, -[AC_TRY_RUN([#include -#include -#if STDC_HEADERS -#include -#include -#endif -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof($1)); - exit(0); -}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl -AC_MSG_RESULT($AC_CV_NAME) -AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME) -undefine([AC_TYPE_NAME])dnl -undefine([AC_CV_NAME])dnl -]) - -#---START: Used in for client configure -AC_DEFUN(MYSQL_TYPE_ACCEPT, -[ac_save_CXXFLAGS="$CXXFLAGS" -AC_CACHE_CHECK([base type of last arg to accept], mysql_cv_btype_last_arg_accept, -AC_LANG_SAVE -AC_LANG_CPLUSPLUS -if test "$ac_cv_prog_gxx" = "yes" -then - CXXFLAGS=`echo $CXXFLAGS -Werror | sed 's/-fbranch-probabilities//'` -fi -mysql_cv_btype_last_arg_accept=none -[AC_TRY_COMPILE([#if defined(inline) -#undef inline -#endif -#include -#include -#include -], -[int a = accept(1, (struct sockaddr *) 0, (socklen_t *) 0); return (a != 0);], -mysql_cv_btype_last_arg_accept=socklen_t)] -if test "$mysql_cv_btype_last_arg_accept" = "none"; then -[AC_TRY_COMPILE([#if defined(inline) -#undef inline -#endif -#include -#include -#include -], -[int a = accept(1, (struct sockaddr *) 0, (size_t *) 0); return (a != 0);], -mysql_cv_btype_last_arg_accept=size_t)] -fi -if test "$mysql_cv_btype_last_arg_accept" = "none"; then -mysql_cv_btype_last_arg_accept=int -fi) -AC_LANG_RESTORE -AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $mysql_cv_btype_last_arg_accept) -CXXFLAGS="$ac_save_CXXFLAGS" -]) -#---END: - -dnl Find type of qsort -AC_DEFUN(MYSQL_TYPE_QSORT, -[AC_CACHE_CHECK([return type of qsort], mysql_cv_type_qsort, -[AC_TRY_COMPILE([#include -#ifdef __cplusplus -extern "C" -#endif -void qsort(void *base, size_t nel, size_t width, - int (*compar) (const void *, const void *)); -], -[int i;], mysql_cv_type_qsort=void, mysql_cv_type_qsort=int)]) -AC_DEFINE_UNQUOTED(RETQSORTTYPE, $mysql_cv_type_qsort) -if test "$mysql_cv_type_qsort" = "void" -then - AC_DEFINE_UNQUOTED(QSORT_TYPE_IS_VOID, 1) -fi -]) - -AC_DEFUN(MYSQL_TIMESPEC_TS, -[AC_CACHE_CHECK([if struct timespec has a ts_sec member], mysql_cv_timespec_ts, -[AC_TRY_COMPILE([#include -#ifdef __cplusplus -extern "C" -#endif -], -[struct timespec abstime; - -abstime.ts_sec = time(NULL)+1; -abstime.ts_nsec = 0; -], mysql_cv_timespec_ts=yes, mysql_cv_timespec_ts=no)]) -if test "$mysql_cv_timespec_ts" = "yes" -then - AC_DEFINE(HAVE_TIMESPEC_TS_SEC) -fi -]) - -AC_DEFUN(MYSQL_TZNAME, -[AC_CACHE_CHECK([if we have tzname variable], mysql_cv_tzname, -[AC_TRY_COMPILE([#include -#ifdef __cplusplus -extern "C" -#endif -], -[ tzset(); - return tzname[0] != 0; -], mysql_cv_tzname=yes, mysql_cv_tzname=no)]) -if test "$mysql_cv_tzname" = "yes" -then - AC_DEFINE(HAVE_TZNAME) -fi -]) - -AC_DEFUN(MYSQL_CHECK_ZLIB_WITH_COMPRESS, [ -save_LIBS="$LIBS" -LIBS="-l$1 $LIBS" -AC_CACHE_CHECK([if libz with compress], mysql_cv_compress, -[AC_TRY_RUN([#include -#ifdef __cplusplus -extern "C" -#endif -int main(int argv, char **argc) -{ - return 0; -} - -int link_test() -{ - return compress(0, (unsigned long*) 0, "", 0); -} -], mysql_cv_compress=yes, mysql_cv_compress=no)]) -if test "$mysql_cv_compress" = "yes" -then - AC_DEFINE(HAVE_COMPRESS) -else - LIBS="$save_LIBS" -fi -]) - -#---START: Used in for client configure -AC_DEFUN(MYSQL_CHECK_ULONG, -[AC_MSG_CHECKING(for type ulong) -AC_CACHE_VAL(ac_cv_ulong, -[AC_TRY_RUN([#include -#include -main() -{ - ulong foo; - foo++; - exit(0); -}], ac_cv_ulong=yes, ac_cv_ulong=no, ac_cv_ulong=no)]) -AC_MSG_RESULT($ac_cv_ulong) -if test "$ac_cv_ulong" = "yes" -then - AC_DEFINE(HAVE_ULONG) -fi -]) - -AC_DEFUN(MYSQL_CHECK_UCHAR, -[AC_MSG_CHECKING(for type uchar) -AC_CACHE_VAL(ac_cv_uchar, -[AC_TRY_RUN([#include -#include -main() -{ - uchar foo; - foo++; - exit(0); -}], ac_cv_uchar=yes, ac_cv_uchar=no, ac_cv_uchar=no)]) -AC_MSG_RESULT($ac_cv_uchar) -if test "$ac_cv_uchar" = "yes" -then - AC_DEFINE(HAVE_UCHAR) -fi -]) - -AC_DEFUN(MYSQL_CHECK_UINT, -[AC_MSG_CHECKING(for type uint) -AC_CACHE_VAL(ac_cv_uint, -[AC_TRY_RUN([#include -#include -main() -{ - uint foo; - foo++; - exit(0); -}], ac_cv_uint=yes, ac_cv_uint=no, ac_cv_uint=no)]) -AC_MSG_RESULT($ac_cv_uint) -if test "$ac_cv_uint" = "yes" -then - AC_DEFINE(HAVE_UINT) -fi -]) - - -AC_DEFUN(MYSQL_CHECK_IN_ADDR_T, -[AC_MSG_CHECKING(for type in_addr_t) -AC_CACHE_VAL(ac_cv_in_addr_t, -[AC_TRY_RUN([#include -#include -#include -#include -#include - -int main(int argc, char **argv) -{ - in_addr_t foo; - exit(0); -}], ac_cv_in_addr_t=yes, ac_cv_in_addr_t=no, ac_cv_in_addr_t=no)]) -AC_MSG_RESULT($ac_cv_in_addr_t) -if test "$ac_cv_in_addr_t" = "yes" -then - AC_DEFINE(HAVE_IN_ADDR_T) -fi -]) - - -AC_DEFUN(MYSQL_PTHREAD_YIELD, -[AC_CACHE_CHECK([if pthread_yield takes zero arguments], ac_cv_pthread_yield_zero_arg, -[AC_TRY_LINK([#define _GNU_SOURCE -#include -#ifdef __cplusplus -extern "C" -#endif -], -[ - pthread_yield(); -], ac_cv_pthread_yield_zero_arg=yes, ac_cv_pthread_yield_zero_arg=yeso)]) -if test "$ac_cv_pthread_yield_zero_arg" = "yes" -then - AC_DEFINE(HAVE_PTHREAD_YIELD_ZERO_ARG) -fi -] -[AC_CACHE_CHECK([if pthread_yield takes 1 argument], ac_cv_pthread_yield_one_arg, -[AC_TRY_LINK([#define _GNU_SOURCE -#include -#ifdef __cplusplus -extern "C" -#endif -], -[ - pthread_yield(0); -], ac_cv_pthread_yield_one_arg=yes, ac_cv_pthread_yield_one_arg=no)]) -if test "$ac_cv_pthread_yield_one_arg" = "yes" -then - AC_DEFINE(HAVE_PTHREAD_YIELD_ONE_ARG) -fi -] -) - - - -#---END: - -AC_DEFUN(MYSQL_CHECK_FP_EXCEPT, -[AC_MSG_CHECKING(for type fp_except) -AC_CACHE_VAL(ac_cv_fp_except, -[AC_TRY_RUN([#include -#include -#include -main() -{ - fp_except foo; - foo++; - exit(0); -}], ac_cv_fp_except=yes, ac_cv_fp_except=no, ac_cv_fp_except=no)]) -AC_MSG_RESULT($ac_cv_fp_except) -if test "$ac_cv_fp_except" = "yes" -then - AC_DEFINE(HAVE_FP_EXCEPT) -fi -]) - -# From fileutils-3.14/aclocal.m4 - -# @defmac AC_PROG_CC_STDC -# @maindex PROG_CC_STDC -# @ovindex CC -# If the C compiler in not in ANSI C mode by default, try to add an option -# to output variable @code{CC} to make it so. This macro tries various -# options that select ANSI C on some system or another. It considers the -# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and -# handles function prototypes correctly. -# -# Patched by monty to only check if __STDC__ is defined. With the original -# check it's impossible to get things to work with the Sunpro compiler from -# Workshop 4.2 -# -# If you use this macro, you should check after calling it whether the C -# compiler has been set to accept ANSI C; if not, the shell variable -# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source -# code in ANSI C, you can make an un-ANSIfied copy of it by using the -# program @code{ansi2knr}, which comes with Ghostscript. -# @end defmac - -AC_DEFUN(AM_PROG_CC_STDC, -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) -AC_CACHE_VAL(am_cv_prog_cc_stdc, -[am_cv_prog_cc_stdc=no -ac_save_CC="$CC" -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -# removed "-Xc -D__EXTENSIONS__" beacause sun c++ does not like it. -for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -do - CC="$ac_save_CC $ac_arg" - AC_TRY_COMPILE( -[#if !defined(__STDC__) -choke me -#endif -/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */ -#ifdef _SEQUENT_ -# include -# include -#endif -], [ -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);};], -[am_cv_prog_cc_stdc="$ac_arg"; break]) -done -CC="$ac_save_CC" -]) -AC_MSG_RESULT($am_cv_prog_cc_stdc) -case "x$am_cv_prog_cc_stdc" in - x|xno) ;; - *) CC="$CC $am_cv_prog_cc_stdc" ;; -esac -]) - -# -# Check to make sure that the build environment is sane. -# - -AC_DEFUN(AM_SANITY_CHECK, -[AC_MSG_CHECKING([whether build environment is sane]) -sleep 1 -echo timestamp > conftestfile -# Do this in a subshell so we don't clobber the current shell's -# arguments. FIXME: maybe try `-L' hack like GETLOADAVG test? -if (set X `ls -t $srcdir/configure conftestfile`; test "[$]2" = conftestfile) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -rm -f conftest* -AC_MSG_RESULT(yes)]) - -# Orginal from bash-2.0 aclocal.m4, Changed to use termcap last by monty. - -AC_DEFUN(MYSQL_CHECK_LIB_TERMCAP, -[ -AC_CACHE_VAL(mysql_cv_termcap_lib, -[AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses, - [AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses, - [AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap, - mysql_cv_termcap_lib=NOT_FOUND)])])]) -AC_MSG_CHECKING(for termcap functions library) -if test "$mysql_cv_termcap_lib" = "NOT_FOUND"; then -AC_MSG_ERROR([No curses/termcap library found]) -elif test "$mysql_cv_termcap_lib" = "libtermcap"; then -TERMCAP_LIB=-ltermcap -elif test "$mysql_cv_termcap_lib" = "libncurses"; then -TERMCAP_LIB=-lncurses -else -TERMCAP_LIB=-lcurses -fi -AC_MSG_RESULT($TERMCAP_LIB) -]) - -dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) -AC_DEFUN(MYSQL_SIGNAL_CHECK, -[AC_REQUIRE([AC_TYPE_SIGNAL]) -AC_MSG_CHECKING(for type of signal functions) -AC_CACHE_VAL(mysql_cv_signal_vintage, -[ - AC_TRY_LINK([#include ],[ - sigset_t ss; - struct sigaction sa; - sigemptyset(&ss); sigsuspend(&ss); - sigaction(SIGINT, &sa, (struct sigaction *) 0); - sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); - ], mysql_cv_signal_vintage=posix, - [ - AC_TRY_LINK([#include ], [ - int mask = sigmask(SIGINT); - sigsetmask(mask); sigblock(mask); sigpause(mask); - ], mysql_cv_signal_vintage=4.2bsd, - [ - AC_TRY_LINK([ - #include - RETSIGTYPE foo() { }], [ - int mask = sigmask(SIGINT); - sigset(SIGINT, foo); sigrelse(SIGINT); - sighold(SIGINT); sigpause(SIGINT); - ], mysql_cv_signal_vintage=svr3, mysql_cv_signal_vintage=v7 - )] - )] -) -]) -AC_MSG_RESULT($mysql_cv_signal_vintage) -if test "$mysql_cv_signal_vintage" = posix; then -AC_DEFINE(HAVE_POSIX_SIGNALS) -elif test "$mysql_cv_signal_vintage" = "4.2bsd"; then -AC_DEFINE(HAVE_BSD_SIGNALS) -elif test "$mysql_cv_signal_vintage" = svr3; then -AC_DEFINE(HAVE_USG_SIGHOLD) -fi -]) - -AC_DEFUN(MYSQL_CHECK_GETPW_FUNCS, -[AC_MSG_CHECKING(whether programs are able to redeclare getpw functions) -AC_CACHE_VAL(mysql_cv_can_redecl_getpw, -[AC_TRY_COMPILE([#include -#include -extern struct passwd *getpwent();], [struct passwd *z; z = getpwent();], - mysql_cv_can_redecl_getpw=yes,mysql_cv_can_redecl_getpw=no)]) -AC_MSG_RESULT($mysql_cv_can_redecl_getpw) -if test "$mysql_cv_can_redecl_getpw" = "no"; then -AC_DEFINE(HAVE_GETPW_DECLS) -fi -]) - -AC_DEFUN(MYSQL_HAVE_TIOCGWINSZ, -[AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h) -AC_CACHE_VAL(mysql_cv_tiocgwinsz_in_ioctl, -[AC_TRY_COMPILE([#include -#include ], [int x = TIOCGWINSZ;], - mysql_cv_tiocgwinsz_in_ioctl=yes,mysql_cv_tiocgwinsz_in_ioctl=no)]) -AC_MSG_RESULT($mysql_cv_tiocgwinsz_in_ioctl) -if test "$mysql_cv_tiocgwinsz_in_ioctl" = "yes"; then -AC_DEFINE(GWINSZ_IN_SYS_IOCTL) -fi -]) - -AC_DEFUN(MYSQL_HAVE_FIONREAD, -[AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h) -AC_CACHE_VAL(mysql_cv_fionread_in_ioctl, -[AC_TRY_COMPILE([#include -#include ], [int x = FIONREAD;], - mysql_cv_fionread_in_ioctl=yes,mysql_cv_fionread_in_ioctl=no)]) -AC_MSG_RESULT($mysql_cv_fionread_in_ioctl) -if test "$mysql_cv_fionread_in_ioctl" = "yes"; then -AC_DEFINE(FIONREAD_IN_SYS_IOCTL) -fi -]) - -AC_DEFUN(MYSQL_HAVE_TIOCSTAT, -[AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h) -AC_CACHE_VAL(mysql_cv_tiocstat_in_ioctl, -[AC_TRY_COMPILE([#include -#include ], [int x = TIOCSTAT;], - mysql_cv_tiocstat_in_ioctl=yes,mysql_cv_tiocstat_in_ioctl=no)]) -AC_MSG_RESULT($mysql_cv_tiocstat_in_ioctl) -if test "$mysql_cv_tiocstat_in_ioctl" = "yes"; then -AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL) -fi -]) - -AC_DEFUN(MYSQL_STRUCT_DIRENT_D_INO, -[AC_REQUIRE([AC_HEADER_DIRENT]) -AC_MSG_CHECKING(if struct dirent has a d_ino member) -AC_CACHE_VAL(mysql_cv_dirent_has_dino, -[AC_TRY_COMPILE([ -#include -#include -#ifdef HAVE_UNISTD_H -# include -#endif /* HAVE_UNISTD_H */ -#if defined(HAVE_DIRENT_H) -# include -#else -# define dirent direct -# ifdef HAVE_SYS_NDIR_H -# include -# endif /* SYSNDIR */ -# ifdef HAVE_SYS_DIR_H -# include -# endif /* SYSDIR */ -# ifdef HAVE_NDIR_H -# include -# endif -#endif /* HAVE_DIRENT_H */ -],[ -struct dirent d; int z; z = d.d_ino; -], mysql_cv_dirent_has_dino=yes, mysql_cv_dirent_has_dino=no)]) -AC_MSG_RESULT($mysql_cv_dirent_has_dino) -if test "$mysql_cv_dirent_has_dino" = "yes"; then -AC_DEFINE(STRUCT_DIRENT_HAS_D_INO) -fi -]) - -AC_DEFUN(MYSQL_TYPE_SIGHANDLER, -[AC_MSG_CHECKING([whether signal handlers are of type void]) -AC_CACHE_VAL(mysql_cv_void_sighandler, -[AC_TRY_COMPILE([#include -#include -#ifdef signal -#undef signal -#endif -#ifdef __cplusplus -extern "C" -#endif -void (*signal ()) ();], -[int i;], mysql_cv_void_sighandler=yes, mysql_cv_void_sighandler=no)])dnl -AC_MSG_RESULT($mysql_cv_void_sighandler) -if test "$mysql_cv_void_sighandler" = "yes"; then -AC_DEFINE(VOID_SIGHANDLER) -fi -]) - -AC_DEFUN(MYSQL_CXX_BOOL, -[ -AC_REQUIRE([AC_PROG_CXX]) -AC_MSG_CHECKING(if ${CXX} supports bool types) -AC_CACHE_VAL(mysql_cv_have_bool, -[ -AC_LANG_SAVE -AC_LANG_CPLUSPLUS -AC_TRY_COMPILE(,[bool b = true;], -mysql_cv_have_bool=yes, -mysql_cv_have_bool=no) -AC_LANG_RESTORE -]) -AC_MSG_RESULT($mysql_cv_have_bool) -if test "$mysql_cv_have_bool" = yes; then -AC_DEFINE(HAVE_BOOL) -fi -])dnl - -AC_DEFUN(MYSQL_STACK_DIRECTION, - [AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, - [AC_TRY_RUN([#include - int find_stack_direction () - { - static char *addr = 0; - auto char dummy; - if (addr == 0) - { - addr = &dummy; - return find_stack_direction (); - } - else - return (&dummy > addr) ? 1 : -1; - } - int main () - { - exit (find_stack_direction() < 0); - }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1, - ac_cv_c_stack_direction=0)]) - AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) -])dnl - -AC_DEFUN(MYSQL_FUNC_ALLOCA, -[ -# Since we have heard that alloca fails on IRIX never define it on a -# SGI machine -if test ! "$host_vendor" = "sgi" -then - AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally. - # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works - # for constant arguments. Useless! - AC_CACHE_CHECK([for working alloca.h], ac_cv_header_alloca_h, - [AC_TRY_LINK([#include ], [char *p = alloca(2 * sizeof(int));], - ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)]) - if test "$ac_cv_header_alloca_h" = "yes" - then - AC_DEFINE(HAVE_ALLOCA) - fi - - AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works, - [AC_TRY_LINK([ - #ifdef __GNUC__ - # define alloca __builtin_alloca - #else - # if HAVE_ALLOCA_H - # include - # else - # ifdef _AIX - #pragma alloca - # else - # ifndef alloca /* predefined by HP cc +Olibcalls */ - char *alloca (); - # endif - # endif - # endif - #endif - ], [char *p = (char *) alloca(1);], - ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)]) - if test "$ac_cv_func_alloca_works" = "yes"; then - AC_DEFINE(HAVE_ALLOCA) - fi - - if test "$ac_cv_func_alloca_works" = "no"; then - # The SVR3 libPW and SVR4 libucb both contain incompatible functions - # that cause trouble. Some versions do not even contain alloca or - # contain a buggy version. If you still want to use their alloca, - # use ar to extract alloca.o from them instead of compiling alloca.c. - ALLOCA=alloca.o - AC_DEFINE(C_ALLOCA) - - AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray, - [AC_EGREP_CPP(webecray, - [#if defined(CRAY) && ! defined(CRAY2) - webecray - #else - wenotbecray - #endif - ], ac_cv_os_cray=yes, ac_cv_os_cray=no)]) - if test "$ac_cv_os_cray" = "yes"; then - for ac_func in _getb67 GETB67 getb67; do - AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func) - break]) - done - fi - fi - AC_SUBST(ALLOCA)dnl -else - AC_MSG_RESULT("Skipped alloca tests") -fi -]) - -AC_DEFUN(MYSQL_CHECK_LONGLONG_TO_FLOAT, -[ -AC_MSG_CHECKING(if conversion of longlong to float works) -AC_CACHE_VAL(ac_cv_conv_longlong_to_float, -[AC_TRY_RUN([#include -typedef long long longlong; -main() -{ - longlong ll=1; - float f; - FILE *file=fopen("conftestval", "w"); - f = (float) ll; - fprintf(file,"%g\n",f); - fclose(file); - exit (0); -}], ac_cv_conv_longlong_to_float=`cat conftestval`, ac_cv_conv_longlong_to_float=0, ifelse([$2], , , ac_cv_conv_longlong_to_float=$2))])dnl -if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes" -then - ac_cv_conv_longlong_to_float=yes -else - ac_cv_conv_longlong_to_float=no -fi -AC_MSG_RESULT($ac_cv_conv_longlong_to_float) -]) - -AC_DEFUN(MYSQL_CHECK_CPU, -[AC_CACHE_CHECK([if compiler supports optimizations for current cpu], -mysql_cv_cpu,[ - -ac_save_CFLAGS="$CFLAGS" -if test -r /proc/cpuinfo ; then - cpuinfo="cat /proc/cpuinfo" - cpu_family=`$cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` - cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` -fi -if test "$cpu_vendor" = "AuthenticAMD"; then - if test $cpu_family -ge 6; then - cpu_set="athlon pentiumpro k5 pentium i486 i386"; - elif test $cpu_family -eq 5; then - cpu_set="k5 pentium i486 i386"; - elif test $cpu_family -eq 4; then - cpu_set="i486 i386" - else - cpu_set="i386" - fi -elif test "$cpu_vendor" = "GenuineIntel"; then - if test $cpu_family -ge 6; then - cpu_set="pentiumpro pentium i486 i386"; - elif test $cpu_family -eq 5; then - cpu_set="pentium i486 i386"; - elif test $cpu_family -eq 4; then - cpu_set="i486 i386" - else - cpu_set="i386" - fi -fi - -for ac_arg in $cpu_set; -do - CFLAGS="$ac_save_CFLAGS -mcpu=$ac_arg -march=$ac_arg -DCPU=$ac_arg" - AC_TRY_COMPILE([],[int i],mysql_cv_cpu=$ac_arg; break;, mysql_cv_cpu="unknown") -done - -if test "$mysql_cv_cpu" = "unknown" -then - CFLAGS="$ac_save_CFLAGS" - AC_MSG_RESULT(none) -else - AC_MSG_RESULT($mysql_cv_cpu) -fi -]])) - -AC_DEFUN(MYSQL_CHECK_VIO, [ - AC_ARG_WITH([vio], - [ --with-vio Include the Virtual IO support], - [vio="$withval"], - [vio=no]) - - if test "$vio" = "yes" - then - vio_dir="vio" - vio_libs="../vio/libvio.la" - AC_DEFINE(HAVE_VIO) - else - vio_dir="" - vio_libs="" - fi - AC_SUBST([vio_dir]) - AC_SUBST([vio_libs]) -]) - -AC_DEFUN(MYSQL_FIND_OPENSSL, [ - incs="$1" - libs="$2" - case "$incs---$libs" in - ---) - for d in /usr/ssl/include /usr/local/ssl/include /usr/include \ -/usr/include/ssl /opt/ssl/include /opt/openssl/include \ -/usr/local/ssl/include /usr/local/include ; do - if test -f $d/openssl/ssl.h ; then - OPENSSL_INCLUDE=-I$d - fi - done - - for d in /usr/ssl/lib /usr/local/ssl/lib /usr/lib/openssl \ -/usr/lib /usr/lib64 /opt/ssl/lib /opt/openssl/lib /usr/local/lib/ ; do - if test -f $d/libssl.a || test -f $d/libssl.so || test -f $d/libssl.dylib ; then - OPENSSL_LIB=$d - fi - done - ;; - ---* | *---) - AC_MSG_ERROR([if either 'includes' or 'libs' is specified, both must be specified]) - ;; - * ) - if test -f $incs/openssl/ssl.h ; then - OPENSSL_INCLUDE=-I$incs - fi - if test -f $libs/libssl.a || test -f $libs/libssl.so || test -f $libs/libssl.dylib ; then - OPENSSL_LIB=$libs - fi - ;; - esac - - # On RedHat 9 we need kerberos to compile openssl - for d in /usr/kerberos/include - do - if test -f $d/krb5.h ; then - OPENSSL_KERBEROS_INCLUDE="$d" - fi - done - - - if test -z "$OPENSSL_LIB" -o -z "$OPENSSL_INCLUDE" ; then - echo "Could not find an installation of OpenSSL" - if test -n "$OPENSSL_LIB" ; then - if test "$IS_LINUX" = "true"; then - echo "Looks like you've forgotten to install OpenSSL development RPM" - fi - fi - exit 1 - fi - -]) - -AC_DEFUN(MYSQL_CHECK_OPENSSL, [ -AC_MSG_CHECKING(for OpenSSL) - AC_ARG_WITH([openssl], - [ --with-openssl Include the OpenSSL support], - [openssl="$withval"], - [openssl=no]) - - AC_ARG_WITH([openssl-includes], - [ - --with-openssl-includes=DIR - Find OpenSSL headers in DIR], - [openssl_includes="$withval"], - [openssl_includes=""]) - - AC_ARG_WITH([openssl-libs], - [ - --with-openssl-libs=DIR - Find OpenSSL libraries in DIR], - [openssl_libs="$withval"], - [openssl_libs=""]) - - if test "$openssl" = "yes" - then - MYSQL_FIND_OPENSSL([$openssl_includes], [$openssl_libs]) - #force VIO use - vio_dir="vio" - vio_libs="../vio/libvio.la" - AC_DEFINE(HAVE_VIO) - AC_MSG_RESULT(yes) - openssl_libs="-L$OPENSSL_LIB -lssl -lcrypto" - # Don't set openssl_includes to /usr/include as this gives us a lot of - # compiler warnings when using gcc 3.x - openssl_includes="" - if test "$OPENSSL_INCLUDE" != "-I/usr/include" - then - openssl_includes="$OPENSSL_INCLUDE" - fi - if test "$OPENSSL_KERBEROS_INCLUDE" - then - openssl_includes="$openssl_includes -I$OPENSSL_KERBEROS_INCLUDE" - fi - AC_DEFINE(HAVE_OPENSSL) - - # openssl-devel-0.9.6 requires dlopen() and we can't link staticly - # on many platforms (We should actually test this here, but it's quite - # hard) to do as we are doing libtool for linking. - using_static="" - case "$CLIENT_EXTRA_LDFLAGS $MYSQLD_EXTRA_LDFLAGS" in - *-all-static*) using_static="yes" ;; - esac - if test "$using_static" = "yes" - then - echo "You can't use the --all-static link option when using openssl." - exit 1 - fi - NON_THREADED_CLIENT_LIBS="$NON_THREADED_CLIENT_LIBS $openssl_libs" - else - AC_MSG_RESULT(no) - fi - AC_SUBST(openssl_libs) - AC_SUBST(openssl_includes) -]) - - -AC_DEFUN(MYSQL_CHECK_MYSQLFS, [ - AC_ARG_WITH([mysqlfs], - [ - --with-mysqlfs Include the corba-based MySQL file system], - [mysqlfs="$withval"], - [mysqlfs=no]) - -dnl Call MYSQL_CHECK_ORBIT even if mysqlfs == no, so that @orbit_*@ -dnl get substituted. - MYSQL_CHECK_ORBIT - - AC_MSG_CHECKING(if we should build MySQLFS) - fs_dirs="" - if test "$mysqlfs" = "yes" - then - if test -n "$orbit_exec_prefix" - then - fs_dirs=fs - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT(disabled because ORBIT, the CORBA ORB, was not found) - fi - else - AC_MSG_RESULT([no]) - fi - AC_SUBST([fs_dirs]) -]) - -AC_DEFUN(MYSQL_CHECK_ORBIT, [ -AC_MSG_CHECKING(for ORBit) -orbit_config_path=`which orbit-config` -if test -n "$orbit_config_path" -a $? = 0 -then - orbit_exec_prefix=`orbit-config --exec-prefix` - orbit_includes=`orbit-config --cflags server` - orbit_libs=`orbit-config --libs server` - orbit_idl="$orbit_exec_prefix/bin/orbit-idl" - AC_MSG_RESULT(found!) - AC_DEFINE(HAVE_ORBIT) -else - orbit_exec_prefix= - orbit_includes= - orbit_libs= - orbit_idl= - AC_MSG_RESULT(not found) -fi -AC_SUBST(orbit_includes) -AC_SUBST(orbit_libs) -AC_SUBST(orbit_idl) -]) - -AC_DEFUN([MYSQL_CHECK_ISAM], [ - AC_ARG_WITH([isam], [ - --with-isam Enable the ISAM table type], - [with_isam="$withval"], - [with_isam=no]) - - isam_libs= - if test X"$with_isam" = X"yes" - then - AC_DEFINE(HAVE_ISAM) - isam_libs="\$(top_builddir)/isam/libnisam.a\ - \$(top_builddir)/merge/libmerge.a" - fi - AC_SUBST(isam_libs) -]) - - -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_CHECK_BDB -dnl Sets HAVE_BERKELEY_DB if inst library is found -dnl Makes sure db version is correct. -dnl Looks in $srcdir for Berkeley distribution if not told otherwise -dnl --------------------------------------------------------------------------- - -AC_DEFUN([MYSQL_CHECK_BDB], [ - AC_ARG_WITH([berkeley-db], - [ - --with-berkeley-db[=DIR] - Use BerkeleyDB located in DIR], - [bdb="$withval"], - [bdb=no]) - - AC_ARG_WITH([berkeley-db-includes], - [ - --with-berkeley-db-includes=DIR - Find Berkeley DB headers in DIR], - [bdb_includes="$withval"], - [bdb_includes=default]) - - AC_ARG_WITH([berkeley-db-libs], - [ - --with-berkeley-db-libs=DIR - Find Berkeley DB libraries in DIR], - [bdb_libs="$withval"], - [bdb_libs=default]) - - AC_MSG_CHECKING([for BerkeleyDB]) - -dnl SORT OUT THE SUPPLIED ARGUMENTS TO DETERMINE WHAT TO DO -dnl echo "DBG1: bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'" - have_berkeley_db=no - case "$bdb" in - no ) - mode=no - AC_MSG_RESULT([no]) - ;; - yes | default ) - case "$bdb_includes---$bdb_libs" in - default---default ) - mode=search-$bdb - AC_MSG_RESULT([searching...]) - ;; - default---* | *---default | yes---* | *---yes ) - AC_MSG_ERROR([if either 'includes' or 'libs' is specified, both must be specified]) - ;; - * ) - mode=supplied-two - AC_MSG_RESULT([supplied]) - ;; - esac - ;; - * ) - mode=supplied-one - AC_MSG_RESULT([supplied]) - ;; - esac - -dnl echo "DBG2: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'" - - case $mode in - no ) - bdb_includes= - bdb_libs= - bdb_libs_with_path= - ;; - supplied-two ) - MYSQL_CHECK_INSTALLED_BDB([$bdb_includes], [$bdb_libs]) - case $bdb_dir_ok in - installed ) mode=yes ;; - * ) AC_MSG_ERROR([didn't find valid BerkeleyDB: $bdb_dir_ok]) ;; - esac - ;; - supplied-one ) - MYSQL_CHECK_BDB_DIR([$bdb]) - case $bdb_dir_ok in - source ) mode=compile ;; - installed ) mode=yes ;; - * ) AC_MSG_ERROR([didn't find valid BerkeleyDB: $bdb_dir_ok]) ;; - esac - ;; - search-* ) - MYSQL_SEARCH_FOR_BDB - case $bdb_dir_ok in - source ) mode=compile ;; - installed ) mode=yes ;; - * ) - # not found - case $mode in - *-yes ) AC_MSG_ERROR([no suitable BerkeleyDB found]) ;; - * ) mode=no ;; - esac - bdb_includes= - bdb_libs= - bdb_libs_with_path= - ;; - esac - ;; - *) - AC_MSG_ERROR([impossible case condition '$mode': please report this to bugs@lists.mysql.com]) - ;; - esac - -dnl echo "DBG3: [$mode] bdb='$bdb'; incl='$bdb_includes'; lib='$bdb_libs'" - case $mode in - no ) - AC_MSG_RESULT([Not using Berkeley DB]) - ;; - yes ) - have_berkeley_db="yes" - AC_MSG_RESULT([Using Berkeley DB in '$bdb_includes']) - ;; - compile ) - have_berkeley_db="$bdb" - AC_MSG_RESULT([Compiling Berekeley DB in '$have_berkeley_db']) - ;; - * ) - AC_MSG_ERROR([impossible case condition '$mode': please report this to bugs@lists.mysql.com]) - ;; - esac - - AC_SUBST(bdb_includes) - AC_SUBST(bdb_libs) - AC_SUBST(bdb_libs_with_path) -]) - -AC_DEFUN([MYSQL_CHECK_INSTALLED_BDB], [ -dnl echo ["MYSQL_CHECK_INSTALLED_BDB ($1) ($2)"] - inc="$1" - lib="$2" - if test -f "$inc/db.h" - then - MYSQL_CHECK_BDB_VERSION([$inc/db.h], - [.*#define[ ]*], [[ ][ ]*]) - - if test X"$bdb_version_ok" = Xyes; then - save_LDFLAGS="$LDFLAGS" - LDFLAGS="-L$lib $LDFLAGS" - AC_CHECK_LIB(db,db_env_create, [ - bdb_dir_ok=installed - MYSQL_TOP_BUILDDIR([inc]) - MYSQL_TOP_BUILDDIR([lib]) - bdb_includes="-I$inc" - bdb_libs="-L$lib -ldb" - bdb_libs_with_path="$lib/libdb.a" - ]) - LDFLAGS="$save_LDFLAGS" - else - bdb_dir_ok="$bdb_version_ok" - fi - else - bdb_dir_ok="no db.h file in '$inc'" - fi -]) - -AC_DEFUN([MYSQL_CHECK_BDB_DIR], [ -dnl ([$bdb]) -dnl echo ["MYSQL_CHECK_BDB_DIR ($1)"] - dir="$1" - - MYSQL_CHECK_INSTALLED_BDB([$dir/include], [$dir/lib]) - - if test X"$bdb_dir_ok" != Xinstalled; then - # test to see if it's a source dir - rel="$dir/dist/RELEASE" - if test -f "$rel"; then - MYSQL_CHECK_BDB_VERSION([$rel], [], [=]) - if test X"$bdb_version_ok" = Xyes; then - bdb_dir_ok=source - bdb="$dir" - MYSQL_TOP_BUILDDIR([dir]) - bdb_includes="-I$dir/build_unix" - bdb_libs="-L$dir/build_unix -ldb" - bdb_libs_with_path="$dir/build_unix/libdb.a" - else - bdb_dir_ok="$bdb_version_ok" - fi - else - bdb_dir_ok="'$dir' doesn't look like a BDB directory ($bdb_dir_ok)" - fi - fi -]) - -AC_DEFUN([MYSQL_SEARCH_FOR_BDB], [ -dnl echo ["MYSQL_SEARCH_FOR_BDB"] - bdb_dir_ok="no BerkeleyDB found" - - for test_dir in $srcdir/bdb $srcdir/db-*.*.* /usr/local/BerkeleyDB*; do -dnl echo "-----------> Looking at ($test_dir; `cd $test_dir && pwd`)" - MYSQL_CHECK_BDB_DIR([$test_dir]) - if test X"$bdb_dir_ok" = Xsource || test X"$bdb_dir_ok" = Xinstalled; then -dnl echo "-----------> Found it ($bdb), ($srcdir)" -dnl This is needed so that 'make distcheck' works properly (VPATH build). -dnl VPATH build won't work if bdb is not under the source tree; but in -dnl that case, hopefully people will just make and install inside the -dnl tree, or install BDB first, and then use the installed version. - case "$bdb" in - "$srcdir/"* ) bdb=`echo "$bdb" | sed -e "s,^$srcdir/,,"` ;; - esac - break - fi - done -]) - -dnl MYSQL_CHECK_BDB_VERSION takes 3 arguments: -dnl 1) the file to look in -dnl 2) the search pattern before DB_VERSION_XXX -dnl 3) the search pattern between DB_VERSION_XXX and the number -dnl It assumes that the number is the last thing on the line -AC_DEFUN([MYSQL_CHECK_BDB_VERSION], [ - db_major=`sed -e '/^[$2]DB_VERSION_MAJOR[$3]/ !d' -e 's///' [$1]` - db_minor=`sed -e '/^[$2]DB_VERSION_MINOR[$3]/ !d' -e 's///' [$1]` - db_patch=`sed -e '/^[$2]DB_VERSION_PATCH[$3]/ !d' -e 's///' [$1]` - test -z "$db_major" && db_major=0 - test -z "$db_minor" && db_minor=0 - test -z "$db_patch" && db_patch=0 - - # This is ugly, but about as good as it can get -# mysql_bdb= -# if test $db_major -eq 3 && test $db_minor -eq 2 && test $db_patch -eq 3 -# then -# mysql_bdb=h -# elif test $db_major -eq 3 && test $db_minor -eq 2 && test $db_patch -eq 9 -# then -# want_bdb_version="3.2.9a" # hopefully this will stay up-to-date -# mysql_bdb=a -# fi - -dnl RAM: -want_bdb_version="4.1.24" -bdb_version_ok=yes - -# if test -n "$mysql_bdb" && \ -# grep "DB_VERSION_STRING.*:.*$mysql_bdb: " [$1] > /dev/null -# then -# bdb_version_ok=yes -# else -# bdb_version_ok="invalid version $db_major.$db_minor.$db_patch" -# bdb_version_ok="$bdb_version_ok (must be version 3.2.3h or $want_bdb_version)" -# fi -]) - -AC_DEFUN([MYSQL_TOP_BUILDDIR], [ - case "$[$1]" in - /* ) ;; # don't do anything with an absolute path - "$srcdir"/* ) - # If BDB is under the source directory, we need to look under the - # build directory for bdb/build_unix. - # NOTE: I'm being lazy, and assuming the user did not specify - # something like --with-berkeley-db=bdb (it would be missing "./"). - [$1]="\$(top_builddir)/"`echo "$[$1]" | sed -e "s,^$srcdir/,,"` - ;; - * ) - AC_MSG_ERROR([The BDB directory must be directly under the MySQL source directory, or be specified using the full path. ('$srcdir'; '$[$1]')]) - ;; - esac - if test X"$[$1]" != "/" - then - [$1]=`echo $[$1] | sed -e 's,/$,,'` - fi -]) - -dnl --------------------------------------------------------------------------- -dnl END OF MYSQL_CHECK_BDB SECTION -dnl --------------------------------------------------------------------------- - -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_CHECK_INNODB -dnl Sets HAVE_INNOBASE_DB if --with-innodb is used -dnl --------------------------------------------------------------------------- - -AC_DEFUN([MYSQL_CHECK_INNODB], [ - AC_ARG_WITH([innodb], - [ - --without-innodb Do not include the InnoDB table handler], - [innodb="$withval"], - [innodb=yes]) - - AC_MSG_CHECKING([for Innodb]) - - have_innodb=no - innodb_includes= - innodb_libs= - case "$innodb" in - yes ) - AC_MSG_RESULT([Using Innodb]) - AC_DEFINE(HAVE_INNOBASE_DB) - have_innodb="yes" - innodb_includes="-I../innobase/include" - innodb_system_libs="" -dnl Some libs are listed several times, in order for gcc to sort out -dnl circular references. - innodb_libs="\ - \$(top_builddir)/innobase/usr/libusr.a\ - \$(top_builddir)/innobase/srv/libsrv.a\ - \$(top_builddir)/innobase/dict/libdict.a\ - \$(top_builddir)/innobase/que/libque.a\ - \$(top_builddir)/innobase/srv/libsrv.a\ - \$(top_builddir)/innobase/ibuf/libibuf.a\ - \$(top_builddir)/innobase/row/librow.a\ - \$(top_builddir)/innobase/pars/libpars.a\ - \$(top_builddir)/innobase/btr/libbtr.a\ - \$(top_builddir)/innobase/trx/libtrx.a\ - \$(top_builddir)/innobase/read/libread.a\ - \$(top_builddir)/innobase/usr/libusr.a\ - \$(top_builddir)/innobase/buf/libbuf.a\ - \$(top_builddir)/innobase/ibuf/libibuf.a\ - \$(top_builddir)/innobase/eval/libeval.a\ - \$(top_builddir)/innobase/log/liblog.a\ - \$(top_builddir)/innobase/fsp/libfsp.a\ - \$(top_builddir)/innobase/fut/libfut.a\ - \$(top_builddir)/innobase/fil/libfil.a\ - \$(top_builddir)/innobase/lock/liblock.a\ - \$(top_builddir)/innobase/mtr/libmtr.a\ - \$(top_builddir)/innobase/page/libpage.a\ - \$(top_builddir)/innobase/rem/librem.a\ - \$(top_builddir)/innobase/thr/libthr.a\ - \$(top_builddir)/innobase/sync/libsync.a\ - \$(top_builddir)/innobase/data/libdata.a\ - \$(top_builddir)/innobase/mach/libmach.a\ - \$(top_builddir)/innobase/ha/libha.a\ - \$(top_builddir)/innobase/dyn/libdyn.a\ - \$(top_builddir)/innobase/mem/libmem.a\ - \$(top_builddir)/innobase/sync/libsync.a\ - \$(top_builddir)/innobase/ut/libut.a\ - \$(top_builddir)/innobase/os/libos.a\ - \$(top_builddir)/innobase/ut/libut.a" - - AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"]) - ;; - * ) - AC_MSG_RESULT([Not using Innodb]) - ;; - esac - - AC_SUBST(innodb_includes) - AC_SUBST(innodb_libs) - AC_SUBST(innodb_system_libs) -]) - -dnl --------------------------------------------------------------------------- -dnl END OF MYSQL_CHECK_INNODB SECTION -dnl --------------------------------------------------------------------------- - -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_CHECK_NDBCLUSTER -dnl Sets HAVE_NDBCLUSTER_DB if --with-ndbcluster is used -dnl --------------------------------------------------------------------------- - -AC_DEFUN([MYSQL_CHECK_NDBCLUSTER], [ - AC_ARG_WITH([ndbcluster], - [ - --without-ndbcluster Do not include the Ndb Cluster table handler], - [ndbcluster="$withval"], - [ndbcluster=yes]) - - AC_MSG_CHECKING([for Ndb Cluster]) - - have_ndbcluster=no - ndbcluster_includes= - ndbcluster_libs= - case "$ndbcluster" in - yes ) - AC_MSG_RESULT([Using Ndb Cluster]) - AC_DEFINE(HAVE_NDBCLUSTER_DB) - have_ndbcluster="yes" - ndbcluster_includes="-I../ndb/include -I../ndb/include/ndbapi" - ndbcluster_libs="\$(top_builddir)/ndb/lib/libNDB_API.a" - ndbcluster_system_libs="" - esac - - AC_SUBST(ndbcluster_includes) - AC_SUBST(ndbcluster_libs) - AC_SUBST(ndbcluster_system_libs) -]) - -dnl --------------------------------------------------------------------------- -dnl END OF MYSQL_CHECK_NDBCLUSTER SECTION -dnl --------------------------------------------------------------------------- - -dnl By default, many hosts won't let programs access large files; -dnl one must use special compiler options to get large-file access to work. -dnl For more details about this brain damage please see: -dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html - -dnl Written by Paul Eggert . - -dnl Internal subroutine of AC_SYS_LARGEFILE. -dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME) -AC_DEFUN(AC_SYS_LARGEFILE_FLAGS, - [AC_CACHE_CHECK([for $1 value to request large file support], - ac_cv_sys_largefile_$1, - [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2 - then - ac_cv_sys_largefile_$1=`cat conftest.1` - else - ac_cv_sys_largefile_$1=no - ifelse($1, CFLAGS, - [case "$host_os" in - # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1. -changequote(, )dnl - hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) -changequote([, ])dnl - if test "$GCC" = yes; then - case `$CC --version 2>/dev/null` in - 2.95.*) ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ ;; - esac - fi - ;; - # IRIX 6.2 and later require cc -n32. -changequote(, )dnl - irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*) -changequote([, ])dnl - if test "$GCC" != yes; then - ac_cv_sys_largefile_CFLAGS=-n32 - fi - esac - if test "$ac_cv_sys_largefile_CFLAGS" != no; then - ac_save_CC="$CC" - CC="$CC $ac_cv_sys_largefile_CFLAGS" - AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no) - CC="$ac_save_CC" - fi]) - fi - rm -f conftest*])]) - -dnl Internal subroutine of AC_SYS_LARGEFILE. -dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL) -AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND, - [case $2 in - no) ;; - ?*) - case "[$]$1" in - '') $1=$2 ;; - *) $1=[$]$1' '$2 ;; - esac ;; - esac]) - -dnl Internal subroutine of AC_SYS_LARGEFILE. -dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT) -AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE, - [AC_CACHE_CHECK([for $1], $2, - [$2=no -changequote(, )dnl - for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do - case "$ac_flag" in - -D$1) - $2=1 ;; - -D$1=*) - $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;; - esac - done - $4 -changequote([, ])dnl - ]) - if test "[$]$2" != no; then - AC_DEFINE_UNQUOTED([$1], [$]$2, [$3]) - fi]) - -AC_DEFUN(MYSQL_SYS_LARGEFILE, - [AC_REQUIRE([AC_CANONICAL_HOST]) - AC_ARG_ENABLE(largefile, - [ --disable-largefile Omit support for large files]) - if test "$enable_largefile" != no; then - AC_CHECK_TOOL(GETCONF, getconf) - AC_SYS_LARGEFILE_FLAGS(CFLAGS) - AC_SYS_LARGEFILE_FLAGS(LDFLAGS) - AC_SYS_LARGEFILE_FLAGS(LIBS) - - for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do - case "$ac_flag" in - no) ;; - -D_FILE_OFFSET_BITS=*) ;; - -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;; - -D_LARGE_FILES | -D_LARGE_FILES=*) ;; - -D?* | -I?*) - AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;; - *) - AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;; - esac - done - AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS") - AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS") - - AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, - ac_cv_sys_file_offset_bits, - [Number of bits in a file offset, on hosts where this is settable.], - [case "$host_os" in - # HP-UX 10.20 and later - hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) - ac_cv_sys_file_offset_bits=64 ;; - # We can't declare _FILE_OFFSET_BITS here as this will cause - # compile errors as AC_PROG_CC adds include files in confdefs.h - # We solve this (until autoconf is fixed) by instead declaring it - # as define instead - solaris2.[8,9]) - CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64" - CXXFLAGS="$CXXFLAGS -D_FILE_OFFSET_BITS=64" - ac_cv_sys_file_offset_bits=no ;; - esac]) - AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, - ac_cv_sys_largefile_source, - [Define to make fseeko etc. visible, on some hosts.], - [case "$host_os" in - # HP-UX 10.20 and later - hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) - ac_cv_sys_largefile_source=1 ;; - esac]) - AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, - ac_cv_sys_large_files, - [Define for large files, on AIX-style hosts.], - [case "$host_os" in - # AIX 4.2 and later - aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*) - ac_cv_sys_large_files=1 ;; - esac]) - fi - ]) - - -# Local version of _AC_PROG_CXX_EXIT_DECLARATION that does not -# include #stdlib.h as default as this breaks things on Solaris -# (Conflicts with pthreads and big file handling) - -m4_define([_AC_PROG_CXX_EXIT_DECLARATION], -[for ac_declaration in \ - ''\ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' \ - '#include ' -do - _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include -$ac_declaration], - [exit (42);])], - [], - [continue]) - _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration], - [exit (42);])], - [break]) -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi -])# _AC_PROG_CXX_EXIT_DECLARATION - -dnl --------------------------------------------------------------------------- - diff --git a/ndb/config/common.mk.am b/ndb/config/common.mk.am index 394da10abd6..593e00d8959 100644 --- a/ndb/config/common.mk.am +++ b/ndb/config/common.mk.am @@ -1,17 +1,13 @@ +ndbbindir = "$(libexecdir)" +ndbtoolsdir = "$(bindir)" +ndbtestdir = "$(bindir)" +ndblibdir = "$(pkglibdir)" +ndbincludedir = "$(pkgincludedir)/ndb" +ndbapiincludedir = "$(pkgincludedir)/ndb/ndbapi" +mgmapiincludedir = "$(pkgincludedir)/ndb/mgmapi" INCLUDES = $(INCLUDES_LOC) LDADD = $(top_srcdir)/ndb/src/common/portlib/gcc.cpp $(LDADD_LOC) DEFS = @DEFS@ @NDB_DEFS@ $(DEFS_LOC) $(NDB_EXTRA_FLAGS) # ndb cannot be compiled with -fno-implicit-templaces NDB_CXXFLAGS=-fimplicit-templates -##use AM_CXXFLAGS for other flags - -#noinst_SCRIPTS = ndb_local_bin -ndb_local_bin: $(PROGRAMS) - set -x; \ - for f in $(PROGRAMS); do \ - g=lib/`basename $$f`; \ - rm -f $$g; \ - @LN_CP_F@ $$f; \ - done; \ - touch $@; diff --git a/ndb/config/config.h.in b/ndb/config/config.h.in deleted file mode 100644 index 82749d5ece6..00000000000 --- a/ndb/config/config.h.in +++ /dev/null @@ -1,993 +0,0 @@ -/* config.h.in. Generated from configure.in by autoheader. */ -/* acconfig.h - This file is in the public domain. - - Descriptive text for the C preprocessor macros that - the distributed Autoconf macros can define. - No software package will use all of them; autoheader copies the ones - your configure.in uses into your configuration header file templates. - - The entries are in sort -df order: alphabetical, case insensitive, - ignoring punctuation (such as underscores). Although this order - can split up related entries, it makes it easier to check whether - a given entry is in the file. - - Leave the following blank line there!! Autoheader needs it. */ - - -#undef C_ALLOCA - -#undef CRAY_STACKSEG_END - -/* Define the default charset name */ -#undef MYSQL_DEFAULT_CHARSET_NAME - -/* Define the default charset name */ -#undef MYSQL_DEFAULT_COLLATION_NAME - -/* Version of .frm files */ -#undef DOT_FRM_VERSION - -/* If LOAD DATA LOCAL INFILE should be enabled by default */ -#undef ENABLED_LOCAL_INFILE - -/* READLINE: */ -#undef FIONREAD_IN_SYS_IOCTL - -/* READLINE: Define if your system defines TIOCGWINSZ in sys/ioctl.h. */ -#undef GWINSZ_IN_SYS_IOCTL - -/* Handing of large files on Solaris 2.6 */ -#undef _FILE_OFFSET_BITS - -/* Do we have FIONREAD */ -#undef FIONREAD_IN_SYS_IOCTL - -/* Do we need to define _GNU_SOURCE */ -#undef _GNU_SOURCE - -/* atomic_add() from (Linux only) */ -#undef HAVE_ATOMIC_ADD - -/* atomic_sub() from (Linux only) */ -#undef HAVE_ATOMIC_SUB - -/* If we have a working alloca() implementation */ -#undef HAVE_ALLOCA - -/* bool is not defined by all C++ compilators */ -#undef HAVE_BOOL - -/* Have berkeley db installed */ -#undef HAVE_BERKELEY_DB - -/* DSB style signals ? */ -#undef HAVE_BSD_SIGNALS - -/* Can netinet be included */ -#undef HAVE_BROKEN_NETINET_INCLUDES - -/* READLINE: */ -#undef HAVE_BSD_SIGNALS - -/* Define charsets you want */ -#undef HAVE_CHARSET_armscii8 -#undef HAVE_CHARSET_ascii -#undef HAVE_CHARSET_big5 -#undef HAVE_CHARSET_cp1250 -#undef HAVE_CHARSET_cp1251 -#undef HAVE_CHARSET_cp1256 -#undef HAVE_CHARSET_cp1257 -#undef HAVE_CHARSET_cp850 -#undef HAVE_CHARSET_cp852 -#undef HAVE_CHARSET_cp866 -#undef HAVE_CHARSET_dec8 -#undef HAVE_CHARSET_euckr -#undef HAVE_CHARSET_gb2312 -#undef HAVE_CHARSET_gbk -#undef HAVE_CHARSET_greek -#undef HAVE_CHARSET_hebrew -#undef HAVE_CHARSET_hp8 -#undef HAVE_CHARSET_keybcs2 -#undef HAVE_CHARSET_koi8r -#undef HAVE_CHARSET_koi8u -#undef HAVE_CHARSET_latin1 -#undef HAVE_CHARSET_latin2 -#undef HAVE_CHARSET_latin5 -#undef HAVE_CHARSET_latin7 -#undef HAVE_CHARSET_macce -#undef HAVE_CHARSET_macroman -#undef HAVE_CHARSET_sjis -#undef HAVE_CHARSET_swe7 -#undef HAVE_CHARSET_tis620 -#undef HAVE_CHARSET_ucs2 -#undef HAVE_CHARSET_ujis -#undef HAVE_CHARSET_utf8 - -/* ZLIB and compress: */ -#undef HAVE_COMPRESS - -/* Define if we are using OSF1 DEC threads */ -#undef HAVE_DEC_THREADS - -/* Define if we are using OSF1 DEC threads on 3.2 */ -#undef HAVE_DEC_3_2_THREADS - -/* fp_except from ieeefp.h */ -#undef HAVE_FP_EXCEPT - -/* READLINE: */ -#undef HAVE_GETPW_DECLS - -/* Solaris define gethostbyname_r with 5 arguments. glibc2 defines - this with 6 arguments */ -#undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE - -/* In OSF 4.0f the 3'd argument to gethostname_r is hostent_data * */ -#undef HAVE_GETHOSTBYNAME_R_RETURN_INT - -/* Define if int8, int16 and int32 types exist */ -#undef HAVE_INT_8_16_32 - -/* Using Innobase DB */ -#undef HAVE_INNOBASE_DB - -/* Using old ISAM tables */ -#undef HAVE_ISAM - -/* Define if we have GNU readline */ -#undef HAVE_LIBREADLINE - -/* Define if have -lwrap */ -#undef HAVE_LIBWRAP - -/* Define if we are using Xavier Leroy's LinuxThreads */ -#undef HAVE_LINUXTHREADS - -/* Do we have lstat */ -#undef HAVE_LSTAT - -/* Do we use user level threads */ -#undef HAVE_mit_thread - -/* Using Ndb Cluster DB */ -#undef HAVE_NDBCLUSTER_DB - -/* For some non posix threads */ -#undef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC - -/* For some non posix threads */ -#undef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT - -/* READLINE: */ -#undef HAVE_POSIX_SIGNALS - -/* Well.. */ -#undef HAVE_POSIX_SIGSETJMP - -/* sigwait with one argument */ -#undef HAVE_NONPOSIX_SIGWAIT - -/* ORBIT */ -#undef HAVE_ORBIT - -/* pthread_attr_setscope */ -#undef HAVE_PTHREAD_ATTR_SETSCOPE - -/* pthread_yield that doesn't take any arguments */ -#undef HAVE_PTHREAD_YIELD_ZERO_ARG - -/* pthread_yield function with one argument */ -#undef HAVE_PTHREAD_YIELD_ONE_ARG - -/* POSIX readdir_r */ -#undef HAVE_READDIR_R - -/* Have Gemini db installed */ -#undef HAVE_GEMINI_DB - -/* POSIX sigwait */ -#undef HAVE_SIGWAIT - -/* crypt */ -#undef HAVE_CRYPT - -/* If we want to have query cache */ -#undef HAVE_QUERY_CACHE - -/* Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines - this with 8 arguments */ -#undef HAVE_SOLARIS_STYLE_GETHOST - -/* MIT pthreads does not support connecting with unix sockets */ -#undef HAVE_THREADS_WITHOUT_SOCKETS - -/* Timespec has a ts_sec instead of tv_sev */ -#undef HAVE_TIMESPEC_TS_SEC - -/* Have the tzname variable */ -#undef HAVE_TZNAME - -/* Define if the system files define uchar */ -#undef HAVE_UCHAR - -/* Define if the system files define uint */ -#undef HAVE_UINT - -/* Define if the system files define ulong */ -#undef HAVE_ULONG - -/* Define if the system files define in_addr_t */ -#undef HAVE_IN_ADDR_T - -/* UNIXWARE7 threads are not posix */ -#undef HAVE_UNIXWARE7_THREADS - -/* new UNIXWARE7 threads that are not yet posix */ -#undef HAVE_UNIXWARE7_POSIX - -/* OpenSSL */ -#undef HAVE_OPENSSL - -/* READLINE: */ -#undef HAVE_USG_SIGHOLD - -/* Virtual IO */ -#undef HAVE_VIO - -/* Handling of large files on Solaris 2.6 */ -#undef _LARGEFILE_SOURCE - -/* Handling of large files on Solaris 2.6 */ -#undef _LARGEFILE64_SOURCE - -/* Define if want -lwrap */ -#undef LIBWRAP - -/* Define to machine type name eg sun10 */ -#undef MACHINE_TYPE - -#undef MUST_REINSTALL_SIGHANDLERS - -/* Defined to used character set */ -#undef MY_CHARSET_CURRENT - -/* READLINE: no sys file*/ -#undef NO_SYS_FILE - -/* Program name */ -#undef PACKAGE - -/* mysql client protocoll version */ -#undef PROTOCOL_VERSION - -/* Define if qsort returns void */ -#undef QSORT_TYPE_IS_VOID - -/* Define as the return type of qsort (int or void). */ -#undef RETQSORTTYPE - -/* Size of off_t */ -#undef SIZEOF_OFF_T - -/* Define as the base type of the last arg to accept */ -#undef SOCKET_SIZE_TYPE - -/* Last argument to get/setsockopt */ -#undef SOCKOPT_OPTLEN_TYPE - -#undef SPEED_T_IN_SYS_TYPES -#undef SPRINTF_RETURNS_PTR -#undef SPRINTF_RETURNS_INT -#undef SPRINTF_RETURNS_GARBAGE - -/* Needed to get large file support on HPUX 10.20 */ -#undef __STDC_EXT__ - -#undef STACK_DIRECTION - -#undef STRCOLL_BROKEN - -#undef STRUCT_DIRENT_HAS_D_FILENO -#undef STRUCT_DIRENT_HAS_D_INO - -#undef STRUCT_WINSIZE_IN_SYS_IOCTL -#undef STRUCT_WINSIZE_IN_TERMIOS - -/* Define to name of system eg solaris*/ -#undef SYSTEM_TYPE - -/* Define if you want to have threaded code. This may be undef on client code */ -#undef THREAD - -/* Should be client be thread safe */ -#undef THREAD_SAFE_CLIENT - -/* READLINE: */ -#undef TIOCSTAT_IN_SYS_IOCTL - -/* Use multi-byte character routines */ -#undef USE_MB -#undef USE_MB_IDENT - -/* the pstack backtrace library */ -#undef USE_PSTACK - -/* Use MySQL RAID */ -#undef USE_RAID - -/* Program version */ -#undef VERSION - -/* READLINE: */ -#undef VOID_SIGHANDLER - -/* used libedit interface (can we dereference result of rl_completion_entry_function?) */ -#undef USE_LIBEDIT_INTERFACE - -/* used new readline interface (does rl_completion_func_t and rl_compentry_func_t defined?) */ -#undef USE_NEW_READLINE_INTERFACE - -/* macro for libedit */ -#undef HAVE_VIS_H -#undef HAVE_FGETLN -#undef HAVE_ISSETUGID -#undef HAVE_STRLCPY -#undef HAVE_GETLINE -#undef HAVE_FLOCKFILE -#undef HAVE_SYS_TYPES_H -#undef HAVE_SYS_CDEFS_H - - -/* Leave that blank line there!! Autoheader needs it. - If you're adding to this file, keep in mind: - The entries are in sort -df order: alphabetical, case insensitive, - ignoring punctuation (such as underscores). */ - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -#undef CRAY_STACKSEG_END - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - -/* Define to 1 if you have the `alarm' function. */ -#undef HAVE_ALARM - -/* Define to 1 if you have `alloca', as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define to 1 if you have and it should be used (not on Ultrix). - */ -#undef HAVE_ALLOCA_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ARPA_INET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ASM_TERMBITS_H - -/* Define to 1 if you have the `bcmp' function. */ -#undef HAVE_BCMP - -/* Define to 1 if you have the `bfill' function. */ -#undef HAVE_BFILL - -/* Define to 1 if you have the `bmove' function. */ -#undef HAVE_BMOVE - -/* Define to 1 if you have the `bzero' function. */ -#undef HAVE_BZERO - -/* Define to 1 if you have the `chsize' function. */ -#undef HAVE_CHSIZE - -/* Define to 1 if you have the `clock_gettime' function. */ -#undef HAVE_CLOCK_GETTIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_CRYPT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_CURSES_H - -/* Define to 1 if you have the `cuserid' function. */ -#undef HAVE_CUSERID - -/* Define to 1 if you have the header file. */ -#undef HAVE_DIRENT_H - -/* Define to 1 if you have the `dlerror' function. */ -#undef HAVE_DLERROR - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the `dlopen' function. */ -#undef HAVE_DLOPEN - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT - -/* Define to 1 if you have the `fchmod' function. */ -#undef HAVE_FCHMOD - -/* Define to 1 if you have the `fcntl' function. */ -#undef HAVE_FCNTL - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `fconvert' function. */ -#undef HAVE_FCONVERT - -/* Define to 1 if you have the `fdatasync' function. */ -#undef HAVE_FDATASYNC - -/* Define to 1 if you have the `fgetln' function. */ -#undef HAVE_FGETLN - -/* Define to 1 if you have the `finite' function. */ -#undef HAVE_FINITE - -/* Define to 1 if you have the header file. */ -#undef HAVE_FLOATINGPOINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FLOAT_H - -/* Define to 1 if you have the `flockfile' function. */ -#undef HAVE_FLOCKFILE - -/* Define to 1 if you have the `fpresetsticky' function. */ -#undef HAVE_FPRESETSTICKY - -/* Define to 1 if you have the `fpsetmask' function. */ -#undef HAVE_FPSETMASK - -/* Define to 1 if you have the `fsync' function. */ -#undef HAVE_FSYNC - -/* Define to 1 if you have the `ftruncate' function. */ -#undef HAVE_FTRUNCATE - -/* Define to 1 if you have the `getcwd' function. */ -#undef HAVE_GETCWD - -/* Define to 1 if you have the `gethostbyaddr_r' function. */ -#undef HAVE_GETHOSTBYADDR_R - -/* Define to 1 if you have the `gethostbyname_r' function. */ -#undef HAVE_GETHOSTBYNAME_R - -/* Define to 1 if you have the `getline' function. */ -#undef HAVE_GETLINE - -/* Define to 1 if you have the `getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the `getpass' function. */ -#undef HAVE_GETPASS - -/* Define to 1 if you have the `getpassphrase' function. */ -#undef HAVE_GETPASSPHRASE - -/* Define to 1 if you have the `getpwnam' function. */ -#undef HAVE_GETPWNAM - -/* Define to 1 if you have the `getpwuid' function. */ -#undef HAVE_GETPWUID - -/* Define to 1 if you have the `getrlimit' function. */ -#undef HAVE_GETRLIMIT - -/* Define to 1 if you have the `getrusage' function. */ -#undef HAVE_GETRUSAGE - -/* Define to 1 if you have the `getwd' function. */ -#undef HAVE_GETWD - -/* Define to 1 if you have the `gmtime_r' function. */ -#undef HAVE_GMTIME_R - -/* Define to 1 if you have the header file. */ -#undef HAVE_GRP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_IEEEFP_H - -/* Define to 1 if you have the `index' function. */ -#undef HAVE_INDEX - -/* Define to 1 if you have the `initgroups' function. */ -#undef HAVE_INITGROUPS - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* isinf() macro or function */ -#undef HAVE_ISINF - -/* Define to 1 if you have the `isnan' function. */ -#undef HAVE_ISNAN - -/* Define to 1 if you have the `issetugid' function. */ -#undef HAVE_ISSETUGID - -/* Define to 1 if you have the `bind' library (-lbind). */ -#undef HAVE_LIBBIND - -/* Define to 1 if you have the `compat' library (-lcompat). */ -#undef HAVE_LIBCOMPAT - -/* Define to 1 if you have the `crypt' library (-lcrypt). */ -#undef HAVE_LIBCRYPT - -/* Define to 1 if you have the `c_r' library (-lc_r). */ -#undef HAVE_LIBC_R - -/* Define to 1 if you have the `dl' library (-ldl). */ -#undef HAVE_LIBDL - -/* Define to 1 if you have the `gen' library (-lgen). */ -#undef HAVE_LIBGEN - -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - -/* Define to 1 if you have the `nsl' library (-lnsl). */ -#undef HAVE_LIBNSL - -/* Define to 1 if you have the `nsl_r' library (-lnsl_r). */ -#undef HAVE_LIBNSL_R - -/* Define to 1 if you have the `posix4' library (-lposix4). */ -#undef HAVE_LIBPOSIX4 - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -#undef HAVE_LIBPTHREAD - -/* Define to 1 if you have the `socket' library (-lsocket). */ -#undef HAVE_LIBSOCKET - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_CONFIG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define to 1 if you have the `localtime_r' function. */ -#undef HAVE_LOCALTIME_R - -/* Define to 1 if you have the `locking' function. */ -#undef HAVE_LOCKING - -/* Define to 1 if you have the `longjmp' function. */ -#undef HAVE_LONGJMP - -/* Define to 1 if you have the `lrand48' function. */ -#undef HAVE_LRAND48 - -/* Define to 1 if you have the `lstat' function. */ -#undef HAVE_LSTAT - -/* Define to 1 if you have the `madvise' function. */ -#undef HAVE_MADVISE - -/* Define to 1 if you have the `mallinfo' function. */ -#undef HAVE_MALLINFO - -/* Define to 1 if you have the header file. */ -#undef HAVE_MALLOC_H - -/* Define to 1 if you have the `memcpy' function. */ -#undef HAVE_MEMCPY - -/* Define to 1 if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mkstemp' function. */ -#undef HAVE_MKSTEMP - -/* Define to 1 if you have the `mlockall' function. */ -#undef HAVE_MLOCKALL - -/* Define to 1 if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define to 1 if you have the header file. */ -#undef HAVE_NDIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_PATHS_H - -/* Define to 1 if you have the `perror' function. */ -#undef HAVE_PERROR - -/* Define to 1 if you have the `poll' function. */ -#undef HAVE_POLL - -/* Define to 1 if you have the `pread' function. */ -#undef HAVE_PREAD - -/* Define to 1 if you have the `pthread_attr_create' function. */ -#undef HAVE_PTHREAD_ATTR_CREATE - -/* Define to 1 if you have the `pthread_attr_getstacksize' function. */ -#undef HAVE_PTHREAD_ATTR_GETSTACKSIZE - -/* Define to 1 if you have the `pthread_attr_setprio' function. */ -#undef HAVE_PTHREAD_ATTR_SETPRIO - -/* Define to 1 if you have the `pthread_attr_setschedparam' function. */ -#undef HAVE_PTHREAD_ATTR_SETSCHEDPARAM - -/* Define to 1 if you have the `pthread_attr_setstacksize' function. */ -#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE - -/* Define to 1 if you have the `pthread_condattr_create' function. */ -#undef HAVE_PTHREAD_CONDATTR_CREATE - -/* Define to 1 if you have the `pthread_getsequence_np' function. */ -#undef HAVE_PTHREAD_GETSEQUENCE_NP - -/* Define to 1 if you have the `pthread_init' function. */ -#undef HAVE_PTHREAD_INIT - -/* Define to 1 if you have the `pthread_key_delete' function. */ -#undef HAVE_PTHREAD_KEY_DELETE - -/* Define to 1 if you have the `pthread_rwlock_rdlock' function. */ -#undef HAVE_PTHREAD_RWLOCK_RDLOCK - -/* Define to 1 if you have the `pthread_setprio' function. */ -#undef HAVE_PTHREAD_SETPRIO - -/* Define to 1 if you have the `pthread_setprio_np' function. */ -#undef HAVE_PTHREAD_SETPRIO_NP - -/* Define to 1 if you have the `pthread_setschedparam' function. */ -#undef HAVE_PTHREAD_SETSCHEDPARAM - -/* Define to 1 if you have the `pthread_sigmask' function. */ -#undef HAVE_PTHREAD_SIGMASK - -/* Define to 1 if you have the `putenv' function. */ -#undef HAVE_PUTENV - -/* Define to 1 if you have the header file. */ -#undef HAVE_PWD_H - -/* Define to 1 if you have the `readlink' function. */ -#undef HAVE_READLINK - -/* Define to 1 if you have the `realpath' function. */ -#undef HAVE_REALPATH - -/* Define to 1 if you have the `regcomp' function. */ -#undef HAVE_REGCOMP - -/* Define to 1 if you have the `rename' function. */ -#undef HAVE_RENAME - -/* Define to 1 if system calls automatically restart after interruption by a - signal. */ -#undef HAVE_RESTARTABLE_SYSCALLS - -/* Define to 1 if you have the `re_comp' function. */ -#undef HAVE_RE_COMP - -/* Define to 1 if you have the `rint' function. */ -#undef HAVE_RINT - -/* Define to 1 if you have the `rwlock_init' function. */ -#undef HAVE_RWLOCK_INIT - -/* Define to 1 if you have the header file. */ -#undef HAVE_SCHED_H - -/* Define to 1 if you have the `select' function. */ -#undef HAVE_SELECT - -/* Define to 1 if you have the header file. */ -#undef HAVE_SELECT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SEMAPHORE_H - -/* Define to 1 if you have the `setenv' function. */ -#undef HAVE_SETENV - -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - -/* Define to 1 if you have the `setupterm' function. */ -#undef HAVE_SETUPTERM - -/* Define to 1 if you have the `sighold' function. */ -#undef HAVE_SIGHOLD - -/* Define to 1 if you have the `sigset' function. */ -#undef HAVE_SIGSET - -/* Define to 1 if you have the `sigthreadmask' function. */ -#undef HAVE_SIGTHREADMASK - -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF - -/* Define to 1 if you have the `socket' function. */ -#undef HAVE_SOCKET - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDARG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDDEF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `stpcpy' function. */ -#undef HAVE_STPCPY - -/* Define to 1 if you have the `strcasecmp' function. */ -#undef HAVE_STRCASECMP - -/* Define to 1 if you have the `strcoll' function. */ -#undef HAVE_STRCOLL - -/* Define to 1 if you have the `strdup' function. */ -#undef HAVE_STRDUP - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strlcat' function. */ -#undef HAVE_STRLCAT - -/* Define to 1 if you have the `strlcpy' function. */ -#undef HAVE_STRLCPY - -/* Define to 1 if you have the `strnlen' function. */ -#undef HAVE_STRNLEN - -/* Define to 1 if you have the `strpbrk' function. */ -#undef HAVE_STRPBRK - -/* Define to 1 if you have the `strstr' function. */ -#undef HAVE_STRSTR - -/* Define to 1 if you have the `strtok_r' function. */ -#undef HAVE_STRTOK_R - -/* Define to 1 if you have the `strtol' function. */ -#undef HAVE_STRTOL - -/* Define to 1 if you have the `strtoll' function. */ -#undef HAVE_STRTOLL - -/* Define to 1 if you have the `strtoul' function. */ -#undef HAVE_STRTOUL - -/* Define to 1 if you have the `strtoull' function. */ -#undef HAVE_STRTOULL - -/* Define to 1 if `st_rdev' is member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_RDEV - -/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use - `HAVE_STRUCT_STAT_ST_RDEV' instead. */ -#undef HAVE_ST_RDEV - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYNCH_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_CDEFS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_DIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_FILE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_IOCTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MALLOC_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MMAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_NDIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PTEM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PTE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STREAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIMEB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UTIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_VADVISE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_WAIT_H - -/* Define to 1 if you have the `tcgetattr' function. */ -#undef HAVE_TCGETATTR - -/* Define to 1 if you have the `tell' function. */ -#undef HAVE_TELL - -/* Define to 1 if you have the `tempnam' function. */ -#undef HAVE_TEMPNAM - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERMBITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERMCAP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERMIOS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERMIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERM_H - -/* Define to 1 if you have the `thr_setconcurrency' function. */ -#undef HAVE_THR_SETCONCURRENCY - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTIME_H - -/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */ -#undef HAVE_UTIME_NULL - -/* Define to 1 if you have the header file. */ -#undef HAVE_VARARGS_H - -/* Define to 1 if you have the `vidattr' function. */ -#undef HAVE_VIDATTR - -/* Define to 1 if you have the header file. */ -#undef HAVE_VIS_H - -/* Define to 1 if you have the `vprintf' function. */ -#undef HAVE_VPRINTF - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - -/* The size of a `char', as computed by sizeof. */ -#undef SIZEOF_CHAR - -/* The size of a `char*', as computed by sizeof. */ -#undef SIZEOF_CHARP - -/* The size of a `int', as computed by sizeof. */ -#undef SIZEOF_INT - -/* The size of a `long', as computed by sizeof. */ -#undef SIZEOF_LONG - -/* The size of a `long long', as computed by sizeof. */ -#undef SIZEOF_LONG_LONG - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION - -/* Define to 1 if the `S_IS*' macros in do not work properly. */ -#undef STAT_MACROS_BROKEN - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Define to 1 if your declares `struct tm'. */ -#undef TM_IN_SYS_TIME - -/* Version number of package */ -#undef VERSION - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - -/* Number of bits in a file offset, on hosts where this is settable. */ -#undef _FILE_OFFSET_BITS - -/* Define to make fseeko etc. visible, on some hosts. */ -#undef _LARGEFILE_SOURCE - -/* Define for large files, on AIX-style hosts. */ -#undef _LARGE_FILES - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define as `__inline' if that's what the C compiler calls it, or to nothing - if it is not supported. */ -#undef inline - -/* Define to `long' if does not define. */ -#undef off_t - -/* Define to `unsigned' if does not define. */ -#undef size_t diff --git a/ndb/config/configure.in b/ndb/config/configure.in deleted file mode 100644 index 4fa5ccdb672..00000000000 --- a/ndb/config/configure.in +++ /dev/null @@ -1,2085 +0,0 @@ -dnl -*- ksh -*- -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-3.4.3-alpha) -AM_CONFIG_HEADER(config.h) - -PROTOCOL_VERSION=10 -DOT_FRM_VERSION=6 -# See the libtool docs for information on how to do shared lib versions. -SHARED_LIB_VERSION=14:0:0 - -# 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]]*-.*$||"` -MYSQL_BASE_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|\.[[^.]]*$||"` -MYSQL_VERSION_ID=`echo $MYSQL_NO_DASH_VERSION. | sed -e 's/\./ /g; s/ \([[0-9]]\) / 0\\1 /g; s/ //g'` - -# The port should be constant for a LONG time -MYSQL_TCP_PORT_DEFAULT=3306 -MYSQL_UNIX_ADDR_DEFAULT="/tmp/mysql.sock" - -##### -##### - -AC_SUBST(MYSQL_NO_DASH_VERSION) -AC_SUBST(MYSQL_BASE_VERSION) -AC_SUBST(MYSQL_VERSION_ID) -AC_SUBST(PROTOCOL_VERSION) -AC_DEFINE_UNQUOTED(PROTOCOL_VERSION, $PROTOCOL_VERSION) -AC_SUBST(DOT_FRM_VERSION) -AC_DEFINE_UNQUOTED(DOT_FRM_VERSION, $DOT_FRM_VERSION) -AC_SUBST(SHARED_LIB_VERSION) - -# Canonicalize the configuration name. -SYSTEM_TYPE="$host_vendor-$host_os" -MACHINE_TYPE="$host_cpu" -AC_SUBST(SYSTEM_TYPE) -AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE") -AC_SUBST(MACHINE_TYPE) -AC_DEFINE_UNQUOTED(MACHINE_TYPE, "$MACHINE_TYPE") - -# Detect intel x86 like processor -BASE_MACHINE_TYPE=$MACHINE_TYPE -case $MACHINE_TYPE in - i?86) BASE_MACHINE_TYPE=i386 ;; -esac - -# Save some variables and the command line options for mysqlbug -SAVE_ASFLAGS="$ASFLAGS" -SAVE_CFLAGS="$CFLAGS" -SAVE_CXXFLAGS="$CXXFLAGS" -SAVE_LDFLAGS="$LDFLAGS" -SAVE_CXXLDFLAGS="$CXXLDFLAGS" -CONF_COMMAND="$0 $ac_configure_args" -AC_SUBST(CONF_COMMAND) -AC_SUBST(SAVE_ASFLAGS) -AC_SUBST(SAVE_CFLAGS) -AC_SUBST(SAVE_CXXFLAGS) -AC_SUBST(SAVE_LDFLAGS) -AC_SUBST(SAVE_CXXLDFLAGS) -AC_SUBST(CXXLDFLAGS) - -AC_PREREQ(2.12)dnl Minimum Autoconf version required. - -AM_MAINTAINER_MODE -#AC_ARG_PROGRAM # Automaticly invoked by AM_INIT_AUTOMAKE -AM_SANITY_CHECK -# This is needed is SUBDIRS is set -AC_PROG_MAKE_SET - -# This is need before AC_PROG_CC -# - -if test "x${CFLAGS-}" = x ; then - cflags_is_set=no -else - cflags_is_set=yes -fi - -if test "x${CPPFLAGS-}" = x ; then - cppflags_is_set=no -else - cppflags_is_set=yes -fi - -if test "x${LDFLAGS-}" = x ; then - ldflags_is_set=no -else - ldflags_is_set=yes -fi - -# The following hack should ensure that configure doesn't add optimizing -# or debugging flags to CFLAGS or CXXFLAGS -CFLAGS="$CFLAGS " -CXXFLAGS="$CXXFLAGS " - -dnl Checks for programs. -AC_PROG_AWK -AC_PROG_CC -AC_PROG_CXX -AC_PROG_CPP - -# Print version of CC and CXX compiler (if they support --version) -case $SYSTEM_TYPE in - *netware*) -CC_VERSION=`$CC -version | grep -i version` - ;; - *) -CC_VERSION=`$CC --version | sed 1q` - ;; -esac -if test $? -eq "0" -then - AC_MSG_CHECKING("C Compiler version"); - AC_MSG_RESULT("$CC $CC_VERSION") -else -CC_VERSION="" -fi -case $SYSTEM_TYPE in - *netware*) -CXX_VERSION=`$CXX -version | grep -i version` - ;; - *) -CXX_VERSION=`$CXX --version | sed 1q` - ;; -esac -if test $? -eq "0" -then - AC_MSG_CHECKING("C++ compiler version"); - AC_MSG_RESULT("$CXX $CXX_VERSION") -else -CXX_VERSION="" -fi -AC_SUBST(CXX_VERSION) -AC_SUBST(CC_VERSION) - -# Fix for sgi gcc / sgiCC which tries to emulate gcc -if test "$CC" = "sgicc" -then - ac_cv_prog_gcc="no" -fi -if test "$CXX" = "sgi++" -then - GXX="no" -fi - -if test "$ac_cv_prog_gcc" = "yes" -then - AS="$CC -c" - AC_SUBST(AS) -else - AC_PATH_PROG(AS, as, as) -fi -# Still need ranlib for readline; local static use only so no libtool. -AC_PROG_RANLIB -# We use libtool -#AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL - -# Ensure that we have --preserve-dup-deps defines, otherwise we get link -# problems of 'mysql' with CXX=g++ -LIBTOOL="$LIBTOOL --preserve-dup-deps" -AC_SUBST(LIBTOOL)dnl - -#AC_LIBTOOL_DLOPEN AC_LIBTOOL_WIN32_DLL AC_DISABLE_FAST_INSTALL AC_DISABLE_SHARED AC_DISABLE_STATIC - -# AC_PROG_INSTALL -AC_PROG_INSTALL -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -# Not critical since the generated file is distributed -AC_PROG_YACC -AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf) -AC_CHECK_PROG(DVIS, tex, manual.dvi) - -AC_MSG_CHECKING("return type of sprintf") - -#check the return type of sprintf -case $SYSTEM_TYPE in - *netware*) - AC_DEFINE(SPRINTF_RETURNS_INT) AC_MSG_RESULT("int") - ;; - *) -AC_TRY_RUN([ - int main() - { - char* s = "hello"; - char buf[6]; - if((int)sprintf(buf, s) == strlen(s)) - return 0; - - return -1; - } - ], -AC_DEFINE(SPRINTF_RETURNS_INT) AC_MSG_RESULT("int"), - AC_TRY_RUN([ - int main() - { - char* s = "hello"; - char buf[6]; - if((char*)sprintf(buf,s) == buf + strlen(s)) - return 0; - return -1; - } -], AC_DEFINE(SPRINTF_RETURNS_PTR) AC_MSG_RESULT("ptr"), - AC_DEFINE(SPRINTF_RETURNS_GARBAGE) AC_MSG_RESULT("garbage"))) - ;; -esac - - -# option, cache_name, variable, -# code to execute if yes, code to exectute if fail -AC_DEFUN(AC_SYS_COMPILER_FLAG, -[ - AC_MSG_CHECKING($1) - OLD_CFLAGS="[$]CFLAGS" - AC_CACHE_VAL(mysql_cv_option_$2, - [ - CFLAGS="[$]OLD_CFLAGS $1" - AC_TRY_RUN([int main(){exit(0);}],mysql_cv_option_$2=yes,mysql_cv_option_$2=no,mysql_cv_option_$2=no) - ]) - - CFLAGS="[$]OLD_CFLAGS" - - if test x"[$]mysql_cv_option_$2" = "xyes" ; then - $3="[$]$3 $1" - AC_MSG_RESULT(yes) - $5 - else - AC_MSG_RESULT(no) - $4 - fi -]) - -# arch, option, cache_name, variable -AC_DEFUN(AC_SYS_CPU_COMPILER_FLAG, -[ - if test "`uname -m 2>/dev/null`" = "$1" ; then - AC_SYS_COMPILER_FLAG($2,$3,$4) - fi -]) - -# os, option, cache_name, variable -AC_DEFUN(AC_SYS_OS_COMPILER_FLAG, -[ - if test "x$mysql_cv_sys_os" = "x$1" ; then - AC_SYS_COMPILER_FLAG($2,$3,$4) - fi -]) - -# We need some special hacks when running slowaris -AC_PATH_PROG(uname_prog, uname, no) - -# We should go through this and put all the explictly system dependent -# stuff in one place -AC_MSG_CHECKING(operating system) -AC_CACHE_VAL(mysql_cv_sys_os, -[ -if test "$uname_prog" != "no"; then - mysql_cv_sys_os="`uname`" -else - mysql_cv_sys_os="Not Solaris" -fi -]) -AC_MSG_RESULT($mysql_cv_sys_os) - -# This should be rewritten to use $target_os -case "$target_os" in - sco3.2v5*) - CFLAGS="$CFLAGS -DSCO" - CXXFLAGS="$CXXFLAGS -DSCO" - LD='$(CC) $(CFLAGS)' - case "$CFLAGS" in - *-belf*) - AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[ - case "$LDFLAGS" in - *-belf*) ;; - *) echo "Adding -belf option to ldflags." - LDFLAGS="$LDFLAGS -belf" - ;; - esac - ]) - ;; - *) - AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[ - case "$LDFLAGS" in - *-belf*) ;; - *) - echo "Adding -belf option to ldflags." - LDFLAGS="$LDFLAGS -belf" - ;; - esac - ]) - ;; - esac - ;; - sysv5UnixWare*) - if test "$GCC" != "yes"; then - # We are using built-in inline function - CFLAGS="$CFLAGS -Kalloca" - fi - CXXFLAGS="$CXXFLAGS -DNO_CPLUSPLUS_ALLOCA" - ;; - sysv5OpenUNIX8*) - if test "$GCC" != "yes"; then - # We are using built-in inline function - CFLAGS="$CFLAGS -Kalloca" - fi - CXXFLAGS="$CXXFLAGS -DNO_CPLUSPLUS_ALLOCA" - ;; -esac -AC_SUBST(CC) -AC_SUBST(CFLAGS) -AC_SUBST(CXX) -AC_SUBST(CXXFLAGS) -AC_SUBST(LD) -AC_SUBST(INSTALL_SCRIPT) - -export CC CXX CFLAGS LD LDFLAGS AR - -if test "$GXX" = "yes" -then - # mysqld requires -fno-implicit-templates. - # Disable exceptions as they seams to create problems with gcc and threads. - # mysqld doesn't use run-time-type-checking, so we disable it. - CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti" - - # If you are using 'gcc' 3.0 (not g++) to compile C++ programs on Linux, - # we will gets some problems when linking static programs. - # The following code is used to fix this problem. - - if test "$CXX" = "gcc" -o "$CXX" = "ccache gcc" - then - if $CXX -v 2>&1 | grep 'version 3' > /dev/null 2>&1 - then - CXXFLAGS="$CXXFLAGS -DUSE_MYSYS_NEW -DDEFINE_CXA_PURE_VIRTUAL" - fi - fi -fi - -# Avoid bug in fcntl on some versions of linux -AC_MSG_CHECKING("if we should use 'skip-locking' as default for $target_os") -# Any wariation of Linux -if expr "$target_os" : "[[Ll]]inux.*" > /dev/null -then - MYSQLD_DEFAULT_SWITCHES="--skip-locking" - IS_LINUX="true" - AC_MSG_RESULT("yes"); -else - MYSQLD_DEFAULT_SWITCHES="" - IS_LINUX="false" - AC_MSG_RESULT("no"); -fi -AC_SUBST(MYSQLD_DEFAULT_SWITCHES) -AC_SUBST(IS_LINUX) - -dnl Find paths to some shell programs -AC_PATH_PROG(LN, ln, ln) -# This must be able to take a -f flag like normal unix ln. -AC_PATH_PROG(LN_CP_F, ln, ln) -if ! ( expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null ); then -# If ln -f does not exists use -s (AFS systems) -if test -n "$LN_CP_F"; then - LN_CP_F="$LN_CP_F -s" -fi -fi - -AC_PATH_PROG(MV, mv, mv) -AC_PATH_PROG(RM, rm, rm) -AC_PATH_PROG(CP, cp, cp) -AC_PATH_PROG(SED, sed, sed) -AC_PATH_PROG(CMP, cmp, cmp) -AC_PATH_PROG(CHMOD, chmod, chmod) -AC_PATH_PROG(HOSTNAME, hostname, hostname) -# Check for a GNU tar named 'gtar', or 'gnutar' (MacOS X) and -# fall back to 'tar' otherwise and hope that it's a GNU tar as well -AC_CHECK_PROGS(TAR, gnutar gtar tar) - -dnl We use a path for perl so the script startup works -dnl We make sure to use perl, not perl5, in hopes that the RPMs will -dnl not depend on the perl5 binary being installed (probably a bug in RPM) -AC_PATH_PROG(PERL, perl, no) -if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1 -then - PERL5=$PERL -else - AC_PATH_PROG(PERL5, perl5, no) - if test "$PERL5" != no - then - PERL=$PERL5 - ac_cv_path_PERL=$ac_cv_path_PERL5 - fi -fi - -AC_SUBST(HOSTNAME) -AC_SUBST(PERL) -AC_SUBST(PERL5) - -# Lock for PS -AC_PATH_PROG(PS, ps, ps) -AC_MSG_CHECKING("how to check if pid exists") -PS=$ac_cv_path_PS -# Linux style -if $PS p $$ 2> /dev/null | grep $0 > /dev/null -then - FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null" -# Solaris -elif $PS -p $$ 2> /dev/null | grep $0 > /dev/null -then - FIND_PROC="$PS -p \$\$PID | grep mysqld > /dev/null" -# BSD style -elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null -then - FIND_PROC="$PS -uaxww | grep mysqld | grep \" \$\$PID \" > /dev/null" -# SysV style -elif $PS -ef 2> /dev/null | grep $0 > /dev/null -then - FIND_PROC="$PS -ef | grep mysqld | grep \" \$\$PID \" > /dev/null" -# Do anybody use this? -elif $PS $$ 2> /dev/null | grep $0 > /dev/null -then - FIND_PROC="$PS \$\$PID | grep mysqld > /dev/null" -else - case $SYSTEM_TYPE in - *freebsd*) - FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null" - ;; - *darwin*) - FIND_PROC="$PS -uaxww | grep mysqld | grep \" \$\$PID \" > /dev/null" - ;; - *cygwin*) - FIND_PROC="$PS -e | grep mysqld | grep \" \$\$PID \" > /dev/null" - ;; - *netware* | *modesto*) - FIND_PROC= - ;; - *) - AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.]) - esac -fi -AC_SUBST(FIND_PROC) -AC_MSG_RESULT("$FIND_PROC") - -# Check if a pid is valid -AC_PATH_PROG(KILL, kill, kill) -AC_MSG_CHECKING("for kill switches") -if $ac_cv_path_KILL -0 $$ -then - CHECK_PID="$ac_cv_path_KILL -0 \$\$PID > /dev/null 2> /dev/null" -elif kill -s 0 $$ -then - CHECK_PID="$ac_cv_path_KILL -s 0 \$\$PID > /dev/null 2> /dev/null" -else - AC_MSG_WARN([kill -0 to check for pid seems to fail]) - CHECK_PID="$ac_cv_path_KILL -s SIGCONT \$\$PID > /dev/null 2> /dev/null" -fi -AC_SUBST(CHECK_PID) -AC_MSG_RESULT("$CHECK_PID") - -# We need a ANSI C compiler -AM_PROG_CC_STDC - -# We need an assembler, too -AM_PROG_AS - -if test "$am_cv_prog_cc_stdc" = "no" -then - AC_MSG_ERROR([MySQL requires a ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.]) -fi - -NOINST_LDFLAGS= - -static_nss="" -STATIC_NSS_FLAGS="" -OTHER_LIBC_LIB="" -AC_ARG_WITH(other-libc, - [ --with-other-libc=DIR Link against libc and other standard libraries - installed in the specified non-standard location - overriding default. Originally added to be able to - link against glibc 2.2 without making the user - upgrade the standard libc installation.], - [ - other_libc_include="$withval/include" - other_libc_lib="$withval/lib" - with_other_libc="yes" - enable_shared="no" - all_is_static="yes" - CFLAGS="$CFLAGS -I$other_libc_include" - # There seems to be a feature in gcc that treats system and libc headers - # silently when they violatate ANSI C++ standard, but it is strict otherwise - # since gcc cannot now recognize that our headers are libc, we work around - # by telling it to be permissive. Note that this option only works with - # new versions of gcc (2.95.x and above) - CXXFLAGS="$CXXFLAGS -fpermissive -I$other_libc_include" - if test -f "$other_libc_lib/libnss_files.a" - then - # libc has been compiled with --enable-static-nss - # we need special flags, but we will have to add those later - STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv" - STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS" - OTHER_LIBC_LIB="-static -L$other_libc_lib" - static_nss=1 - else - # this is a dirty hack. We if we detect static nss glibc in the special - # location, we do not re-direct the linker to get libraries from there - # during check. The reason is that if we did, we would have to find a - # way to append the special static nss flags to LIBS every time we do - # any check - this is definitely feasible, but not worthwhile the risk - # of breaking other things. So for our purposes it would be sufficient - # to assume that whoever is using static NSS knows what he is doing and - # has sensible libraries in the regular location - LDFLAGS="$LDFLAGS -static -L$other_libc_lib " - fi - - # When linking against custom libc installed separately, we want to force - # all binary builds to be static, including the build done by configure - # itself to test for system features. - with_mysqld_ldflags="-all-static" - with_client_ldflags="-all-static" - NOINST_LDFLAGS="-all-static" - ], - [ - other_libc_include= - other_libc_lib= - with_other_libc="no" - ] -) -AC_SUBST(NOINST_LDFLAGS) - -# -# Check if we are using Linux and a glibc compiled with static nss -# (this is true on the MySQL build machines to avoid NSS problems) -# - -if test "$IS_LINUX" = "true" -a "$static_nss" = "" -then - tmp=`nm /usr/lib/libc.a | grep _nss_files_getaliasent_r` - if test -n "$tmp" - then - STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv" - STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS" - static_nss=1 - fi -fi - - -AC_ARG_WITH(server-suffix, - [ --with-server-suffix Append value to the version string.], - [ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e 's/^\(...................................\)..*$/\1/'` ], - [ MYSQL_SERVER_SUFFIX= ] - ) -AC_SUBST(MYSQL_SERVER_SUFFIX) - -# Set flags if we wants to have MIT threads. -AC_ARG_WITH(mit-threads, - [ --with-mit-threads Always use included thread lib.], - [ with_mit_threads=$withval ], - [ with_mit_threads=no ] - ) - -if test "$with_mit_threads" = "yes" -then - enable_largefile="no" # Will not work on Linux. -fi - -# Set flags if we want to force to use pthreads -AC_ARG_WITH(pthread, - [ --with-pthread Force use of pthread library.], - [ with_pthread=$withval ], - [ with_pthread=no ] - ) - -# Force use of thread libs LIBS -AC_ARG_WITH(named-thread-libs, - [ --with-named-thread-libs=ARG - Use specified thread libraries instead of - those automatically found by configure.], - [ with_named_thread=$withval ], - [ with_named_thread=no ] - ) - -# Force use of a curses libs -AC_ARG_WITH(named-curses-libs, - [ --with-named-curses-libs=ARG - Use specified curses libraries instead of - those automatically found by configure.], - [ with_named_curses=$withval ], - [ with_named_curses=no ] - ) - -# Force use of a zlib (compress) -AC_ARG_WITH(named-z-libs, - [ --with-named-z-libs=ARG - Use specified zlib libraries instead of - those automatically found by configure.], - [ with_named_zlib=$withval ], - [ with_named_zlib=z ] - ) - -# Make thread safe client -AC_ARG_ENABLE(thread-safe-client, - [ --enable-thread-safe-client - Compile the client with threads.], - [ THREAD_SAFE_CLIENT=$enableval ], - [ THREAD_SAFE_CLIENT=no ] - ) - -# compile with strings functions in assembler -AC_ARG_ENABLE(assembler, - [ --enable-assembler Use assembler versions of some string - functions if available.], - [ ENABLE_ASSEMBLER=$enableval ], - [ ENABLE_ASSEMBLER=no ] - ) - -AC_MSG_CHECKING(if we should use assembler functions) -# For now we only support assembler on i386 and sparc systems -AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386") -AM_CONDITIONAL(ASSEMBLER_sparc32, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc") -AM_CONDITIONAL(ASSEMBLER_sparc64, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparcv9") -AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc32_TRUE" = "") - -if test "$ASSEMBLER_TRUE" = "" -then - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no]) -fi - - -AC_MSG_CHECKING(if we should use RAID) -AC_ARG_WITH(raid, - [ --with-raid Enable RAID Support], - [ USE_RAID=$withval ], - [ USE_RAID=no ] - ) -if test "$USE_RAID" = "yes" -then - AC_MSG_RESULT([yes]) - AC_DEFINE([USE_RAID]) -else - AC_MSG_RESULT([no]) -fi - -# Use this to set the place used for unix socket used to local communication. -AC_ARG_WITH(unix-socket-path, - [ --with-unix-socket-path=SOCKET - Where to put the unix-domain socket. SOCKET must be - an absolute file name.], - [ MYSQL_UNIX_ADDR=$withval ], - [ MYSQL_UNIX_ADDR=$MYSQL_UNIX_ADDR_DEFAULT ] - ) -AC_SUBST(MYSQL_UNIX_ADDR) - -AC_ARG_WITH(tcp-port, - [ --with-tcp-port=port-number - Which port to use for MySQL services (default 3306)], - [ MYSQL_TCP_PORT=$withval ], - [ MYSQL_TCP_PORT=$MYSQL_TCP_PORT_DEFAULT ] - ) -AC_SUBST(MYSQL_TCP_PORT) -# We might want to document the assigned port in the manual. -AC_SUBST(MYSQL_TCP_PORT_DEFAULT) - -# Use this to set the place used for unix socket used to local communication. -AC_ARG_WITH(mysqld-user, - [ --with-mysqld-user=username - What user the mysqld daemon shall be run as.], - [ MYSQLD_USER=$withval ], - [ MYSQLD_USER=mysql ] - ) -AC_SUBST(MYSQLD_USER) - -# If we should allow LOAD DATA LOCAL -AC_MSG_CHECKING(If we should should enable LOAD DATA LOCAL by default) -AC_ARG_ENABLE(local-infile, - [ --enable-local-infile Enable LOAD DATA LOCAL INFILE (default: disabled)], - [ ENABLED_LOCAL_INFILE=$enableval ], - [ ENABLED_LOCAL_INFILE=no ] - ) -if test "$ENABLED_LOCAL_INFILE" = "yes" -then - AC_MSG_RESULT([yes]) - AC_DEFINE([ENABLED_LOCAL_INFILE]) -else - AC_MSG_RESULT([no]) -fi - -MYSQL_SYS_LARGEFILE - -# Types that must be checked AFTER large file support is checked -AC_TYPE_SIZE_T - -#-------------------------------------------------------------------- -# Check for system header files -#-------------------------------------------------------------------- - -AC_HEADER_DIRENT -AC_HEADER_STDC -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \ - memory.h pwd.h select.h \ - stdlib.h stddef.h \ - strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \ - sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \ - unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \ - sys/ioctl.h malloc.h sys/malloc.h linux/config.h) - -#-------------------------------------------------------------------- -# Check for system libraries. Adds the library to $LIBS -# and defines HAVE_LIBM etc -#-------------------------------------------------------------------- - -AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity)) - -AC_CHECK_LIB(nsl_r, gethostbyname_r, [], - AC_CHECK_LIB(nsl, gethostbyname_r)) -AC_CHECK_FUNC(gethostbyname_r) - -AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) -AC_CHECK_FUNC(yp_get_default_domain, , - AC_CHECK_LIB(nsl, yp_get_default_domain)) -AC_CHECK_FUNC(p2open, , AC_CHECK_LIB(gen, p2open)) -# This may get things to compile even if bind-8 is installed -AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind)) -# For crypt() on Linux -AC_CHECK_LIB(crypt, crypt) -AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT)) - -# For sem_xxx functions on Solaris 2.6 -AC_CHECK_FUNC(sem_init, , AC_CHECK_LIB(posix4, sem_init)) - -# For compress in zlib -MYSQL_CHECK_ZLIB_WITH_COMPRESS($with_named_zlib) - -#-------------------------------------------------------------------- -# Check for TCP wrapper support -#-------------------------------------------------------------------- - -AC_ARG_WITH(libwrap, -[ --with-libwrap[=DIR] Compile in libwrap (tcp_wrappers) support],[ - case "$with_libwrap" in - no) : ;; - yes|*) - _cppflags=${CPPFLAGS} - _ldflags=${LDFLAGS} - - if test "$with_libwrap" != "yes"; then - CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include" - LDFLAGS="${LDFLAGS} -L$with_libwrap/lib" - fi - - _libs=${LIBS} - AC_CHECK_HEADER(tcpd.h, - LIBS="-lwrap $LIBS" - AC_MSG_CHECKING(for TCP wrappers library -lwrap) - AC_TRY_LINK([#include -int allow_severity = 0; -int deny_severity = 0; - -struct request_info *req; -],[hosts_access (req)], - AC_MSG_RESULT(yes) - AC_DEFINE(LIBWRAP) - AC_DEFINE(HAVE_LIBWRAP) - if test "$with_libwrap" != "yes"; then - WRAPLIBS="-L${with_libwrap}/lib" - fi - WRAPLIBS="${WRAPLIBS} -lwrap", - AC_MSG_RESULT(no) - CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}), - CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}) - LDFLAGS=${_ldflags} LIBS=${_libs} - ;; - esac -]) -AC_SUBST(WRAPLIBS) - -if test "$IS_LINUX" = "true"; then - AC_MSG_CHECKING([for atomic operations]) - - atom_ops= - AC_TRY_RUN([ -#include -int main() -{ - atomic_t v; - - atomic_set(&v, 23); - atomic_add(5, &v); - return atomic_read(&v) == 28 ? 0 : -1; -} - ], AC_DEFINE(HAVE_ATOMIC_ADD) atom_ops="${atom_ops}atomic_add ", - ) - AC_TRY_RUN([ -#include -int main() -{ - atomic_t v; - - atomic_set(&v, 23); - atomic_sub(5, &v); - return atomic_read(&v) == 18 ? 0 : -1; -} - ], AC_DEFINE(HAVE_ATOMIC_SUB) atom_ops="${atom_ops}atomic_sub ", - ) - - if test -z "$atom_ops"; then atom_ops="no"; fi - AC_MSG_RESULT($atom_ops) - - AC_ARG_WITH(pstack, - [ --with-pstack Use the pstack backtrace library], - [ USE_PSTACK=$withval ], - [ USE_PSTACK=no ]) - pstack_libs= - pstack_dirs= - if test "$USE_PSTACK" = yes -a "$IS_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386" -a "$with_mit_threads" = "no" - then - have_libiberty= have_libbfd= - my_save_LIBS="$LIBS" -dnl I have no idea if this is a good test - can not find docs for libiberty - AC_CHECK_LIB([iberty], [fdmatch], - [have_libiberty=yes - AC_CHECK_LIB([bfd], [bfd_openr], [have_libbfd=yes], , [-liberty])]) - LIBS="$my_save_LIBS" - - if test x"$have_libiberty" = xyes -a x"$have_libbfd" = xyes - then - pstack_dirs='$(top_srcdir)'/pstack - pstack_libs="../pstack/libpstack.a -lbfd -liberty" - # We must link staticly when using pstack - with_mysqld_ldflags="-all-static" - AC_SUBST([pstack_dirs]) - AC_SUBST([pstack_libs]) - AC_DEFINE([USE_PSTACK]) -dnl This check isn't needed, but might be nice to give some feedback.... -dnl AC_CHECK_HEADER(libiberty.h, -dnl have_libiberty_h=yes, -dnl have_libiberty_h=no) - else - USE_PSTACK="no" - fi - else - USE_PSTACK="no" - fi -fi -AM_CONDITIONAL(COMPILE_PSTACK, test "$USE_PSTACK" = "yes") -AC_MSG_CHECKING([if we should use pstack]) -AC_MSG_RESULT([$USE_PSTACK]) - -# Check for gtty if termio.h doesn't exists -if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no" -then - AC_CHECK_FUNC(gtty, , AC_CHECK_LIB(compat, gtty)) -fi -# We make a special variable for client library's to avoid including -# thread libs in the client. -NON_THREADED_CLIENT_LIBS="$LIBS" - -AC_MSG_CHECKING([for int8]) -case $SYSTEM_TYPE in - *netware) - AC_MSG_RESULT([no]) - ;; - *) -AC_TRY_RUN([ -#ifdef HAVE_STDLIB_H -#include -#endif - -#ifdef HAVE_STDDEF_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -int main() -{ - int8 i; - return 0; -} -], AC_DEFINE(HAVE_INT_8_16_32) AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]) -) - ;; -esac - -# -# Some system specific hacks -# - -MAX_C_OPTIMIZE="-O3" -MAX_CXX_OPTIMIZE="-O3" - -case $SYSTEM_TYPE in - *solaris2.7*) - # Solaris 2.7 has a broken /usr/include/widec.h - # Make a fixed copy in ./include - echo "Fixing broken include files for $SYSTEM_TYPE" - echo " - Creating local copy of widec.h" - if test ! -d include - then - mkdir ./include - fi - builddir=`pwd` - sed -e "s|^#if[ ]*!defined(lint) && !defined(__lint)|#if !defined\(lint\) \&\& !defined\(__lint\) \&\& !defined\(getwc\)|" < /usr/include/widec.h > include/widec.h - CFLAGS="$CFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T" - CXXFLAGS="$CXXFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T" - ;; - *solaris2.8*) - # Solaris 2.8 has a broken /usr/include/widec.h - # Make a fixed copy in ./include - echo "Fixing broken include files for $SYSTEM_TYPE" - echo " - Creating local copy of widec.h" - if test ! -d include - then - mkdir ./include - fi - builddir=`pwd` - sed -e "s|^#if[ ]*!defined(__lint)|#if !defined\(__lint\) \&\& !defined\(getwc\)|" < /usr/include/widec.h > include/widec.h - CFLAGS="$CFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T" - CXXFLAGS="$CXXFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T" - ;; - *solaris2.5.1*) - echo "Enabling getpass() workaround for Solaris 2.5.1" - CFLAGS="$CFLAGS -DHAVE_BROKEN_GETPASS -DSOLARIS -DHAVE_RWLOCK_T"; - CXXFLAGS="$CXXFLAGS -DHAVE_RWLOCK_T -DSOLARIS" - ;; - *solaris*) - CFLAGS="$CFLAGS -DHAVE_RWLOCK_T" - CXXFLAGS="$CXXFLAGS -DHAVE_RWLOCK_T" - ;; - *SunOS*) - echo "Enabling getpass() workaround for SunOS" - CFLAGS="$CFLAGS -DHAVE_BROKEN_GETPASS -DSOLARIS"; - ;; - *hpux10.20*) - echo "Enabling workarounds for hpux 10.20" - CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX10 -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT -DHAVE_POSIX1003_4a_MUTEX" - CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX10 -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT -DHAVE_POSIX1003_4a_MUTEX" - if test "$with_named_thread" = "no" - then - echo "Using --with-named-thread=-lpthread" - with_named_thread="-lcma" - fi - ;; - *hpux11.*) - echo "Enabling workarounds for hpux 11" - CFLAGS="$CFLAGS -DHPUX11 -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT" - CXXFLAGS="$CXXFLAGS -DHPUX11 -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT" - if test "$with_named_thread" = "no" - then - echo "Using --with-named-thread=-lpthread" - with_named_thread="-lpthread" - fi - # Fixes for HPUX 11.0 compiler - if test "$ac_cv_prog_gcc" = "no" - then - CFLAGS="$CFLAGS -DHAVE_BROKEN_INLINE" - CXXFLAGS="$CXXFLAGS +O2" - MAX_C_OPTIMIZE="" - MAX_CXX_OPTIMIZE="" - fi - ;; - *rhapsody*) - if test "$ac_cv_prog_gcc" = "yes" - then - CPPFLAGS="$CPPFLAGS -traditional-cpp " - CFLAGS="-DHAVE_CTHREADS_WRAPPER -DDO_NOT_REMOVE_THREAD_WRAPPERS" - CXXFLAGS="-DHAVE_CTHREADS_WRAPPER" - if test $with_named_curses = "no" - then - with_named_curses="" - fi - fi - ;; - *darwin5*) - if test "$ac_cv_prog_gcc" = "yes" - then - FLAGS="-traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH" - CFLAGS="$CFLAGS $FLAGS" - CXXFLAGS="$CXXFLAGS $FLAGS" - MAX_C_OPTIMIZE="-O" - with_named_curses="" - fi - ;; - *darwin6*) - if test "$ac_cv_prog_gcc" = "yes" - then - FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH" - CFLAGS="$CFLAGS $FLAGS" - CXXFLAGS="$CXXFLAGS $FLAGS" - MAX_C_OPTIMIZE="-O" - fi - ;; - *darwin7*) - if test "$ac_cv_prog_gcc" = "yes" - then - FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ" - CFLAGS="$CFLAGS $FLAGS" - CXXFLAGS="$CXXFLAGS $FLAGS" - MAX_C_OPTIMIZE="-O" - fi - ;; - *freebsd*) - echo "Adding fix for interrupted reads" - OSVERSION=`sysctl -a | grep osreldate | awk '{ print $2 }'` - if test "$OSVERSION" -gt "480100" && \ - test "$OSVERSION" -lt "500000" || \ - test "$OSVERSION" -gt "500109" - then - CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000" - else - CFLAGS="$CFLAGS -DHAVE_BROKEN_REALPATH" - CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000 -DHAVE_BROKEN_REALPATH" - fi - ;; - *netbsd*) - echo "Adding flag -Dunix" - CFLAGS="$CFLAGS -Dunix" - CXXFLAGS="$CXXFLAGS -Dunix" - OVERRIDE_MT_LD_ADD="\$(top_srcdir)/mit-pthreads/obj/libpthread.a" - ;; - *bsdi*) - echo "Adding fix for BSDI" - CFLAGS="$CFLAGS -D__BSD__ -DHAVE_BROKEN_REALPATH" - AC_DEFINE_UNQUOTED(SOCKOPT_OPTLEN_TYPE, size_t) - ;; - *sgi-irix6*) - if test "$with_named_thread" = "no" - then - echo "Using --with-named-thread=-lpthread" - with_named_thread="-lpthread" - fi - CXXFLAGS="$CXXFLAGS -D_BOOL" - ;; - *aix4.3*) - echo "Adding defines for AIX" - CFLAGS="$CFLAGS -Wa,-many -DUNDEF_HAVE_INITGROUPS -DSIGNALS_DONT_BREAK_READ" - CXXFLAGS="$CXXFLAGS -Wa,-many -DUNDEF_HAVE_INITGROUPS -DSIGNALS_DONT_BREAK_READ" - ;; -dnl Is this the right match for DEC OSF on alpha? - *dec-osf*) - if test "$ac_cv_prog_gcc" = "yes" && test "$host_cpu" = "alpha" - then - echo "Adding defines for DEC OSF on alpha" - CFLAGS="$CFLAGS -mieee" - CXXFLAGS="$CXXFLAGS -mieee" - fi - echo "Adding defines for OSF1" - # gethostbyname_r is deprecated and doesn't work ok on OSF1 - CFLAGS="$CFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R" - CXXFLAGS="$CXXFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R" - ;; - *netware*) - # No need for curses library so set it to null - with_named_curses="" - - # No thread library - in LibC - with_named_thread="" - - # - # Edit Makefile.in files. - # - echo -n "configuring Makefile.in files for NetWare... " - for file in sql/Makefile.in libmysql/Makefile.in libmysql_r/Makefile.in sql/share/Makefile.in strings/Makefile.in client/Makefile.in - do - # echo "#### $file ####" - filedir="`dirname $file`" - filebase="`basename $file`" - filesed=$filedir/$filebase.sed - # - # Backup and always use original file - # - if test -f $file.bk - then - cp -fp $file.bk $file - else - cp -fp $file $file.bk - fi - case $file in - sql/Makefile.in) - # Use gen_lex_hash.linux instead of gen_lex_hash - # Add library dependencies to mysqld_DEPENDENCIES - lib_DEPENDENCIES="\$(bdb_libs_with_path) \$(innodb_libs) \$(pstack_libs) \$(innodb_system_libs) \$(openssl_libs)" - cat > $filesed << EOF -s,\(^.*\$(MAKE) gen_lex_hash\),#\1, -s,\(\./gen_lex_hash\),\1.linux, -s%\(mysqld_DEPENDENCIES = \) %\1$lib_DEPENDENCIES % -EOF - ;; - sql/share/Makefile.in) - cat > $filesed << EOF -s,\(extra/comp_err\),\1.linux, -EOF - ;; - libmysql/Makefile.in) - cat > $filesed << EOF -s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.linux\2, -s,\(: conf_to_src\),\1.linux, -EOF - ;; - libmysql_r/Makefile.in) - cat > $filesed << EOF -s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.linux\2, -s,\(: conf_to_src\),\1.linux, -EOF - ;; - strings/Makefile.in) - cat > $filesed << EOF -s,\(\./conf_to_src\)\( \$(top_srcdir)\),\1.linux\2, -s,\(: conf_to_src\),\1.linux, -EOF - ;; - client/Makefile.in) - # - cat > $filesed << EOF -s,libmysqlclient.la,.libs/libmysqlclient.a, -EOF - ;; - esac - if `sed -f $filesed $file > $file.nw`;\ - then - mv -f $file.nw $file - rm -f $filesed - else - exit 1 - fi - # wait for file system changes to complete - sleep 1 - done - echo "done" - - # - # Make sure the following files are writable. - # - # When the files are retrieved from some source code control systems they are read-only. - # - echo -n "making sure specific build files are writable... " - for file in \ - Docs/include.texi \ - Docs/mysql.info \ - Docs/manual.txt \ - Docs/manual_toc.html \ - Docs/manual.html \ - Docs/INSTALL-BINARY \ - INSTALL-SOURCE \ - COPYING \ - COPYING.LIB \ - MIRRORS - do - if test -e $file; then - chmod +w $file - fi - done - echo "done" - - ;; -esac - - -#---START: Used in for client configure -# Check if we threads are in libc or if we should use -# -lpthread, -lpthreads or mit-pthreads -# We have to check libc last because else it fails on Solaris 2.6 - -with_posix_threads="no" -# Hack for DEC-UNIX (OSF1) -if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no" -then - # Look for LinuxThreads. - AC_MSG_CHECKING("LinuxThreads") - res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l` - if test "$res" -gt 0 - then - AC_MSG_RESULT("Found") - AC_DEFINE(HAVE_LINUXTHREADS) - # Linux 2.0 sanity check - AC_TRY_COMPILE([#include ], [int a = sched_get_priority_min(1);], , - AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual])) - # RedHat 5.0 does not work with dynamic linking of this. -static also - # gives a speed increase in linux so it does not hurt on other systems. - with_named_thread="-lpthread" - else - AC_MSG_RESULT("Not found") - # If this is a linux machine we should barf - if test "$IS_LINUX" = "true" - then - AC_MSG_ERROR([This is a linux system and Linuxthreads was not -found. On linux Linuxthreads should be used. Please install Linuxthreads -(or a new glibc) and try again. See the Installation chapter in the -Reference Manual for more information.]) - else - AC_MSG_CHECKING("DEC threads") - if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a - then - with_named_thread="-lpthread -lmach -lexc" - CFLAGS="$CFLAGS -D_REENTRANT" - CXXFLAGS="$CXXFLAGS -D_REENTRANT" - AC_DEFINE(HAVE_DEC_THREADS) - AC_MSG_RESULT("yes") - else - AC_MSG_RESULT("no") - AC_MSG_CHECKING("DEC 3.2 threads") - if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a - then - with_named_thread="-lpthreads -lmach -lc_r" - AC_DEFINE(HAVE_DEC_THREADS) - AC_DEFINE(HAVE_DEC_3_2_THREADS) - with_osf32_threads="yes" - MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority" - AC_MSG_RESULT("yes") - else - AC_MSG_RESULT("no") - fi - fi - fi - fi -fi - - -dnl This is needed because -lsocket has to come after the thread -dnl library on SCO. -AC_DEFUN([MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK], [ - LIBS=`echo " $LIBS " | sed -e 's/ -lsocket / /g'` -]) -# Hack for SCO UNIX -if test "$with_named_thread" = "no" -then - AC_MSG_CHECKING("SCO threads") - if expr "$SYSTEM_TYPE" : ".*sco.*" > /dev/null - then - if test -f /usr/lib/libgthreads.a -o -f /usr/lib/libgthreads.so - then - MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK - with_named_thread="-lgthreads -lsocket -lgthreads" - # sched.h conflicts with fsu-threads - touch ./include/sched.h - - # We must have gcc - if expr "$CC" : ".*gcc.*" - then - AC_MSG_RESULT("yes") - else - AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.]); - fi - AC_MSG_RESULT("yes") - elif test -f /usr/local/lib/libpthread.a -o -f /usr/local/lib/libpthread.so - then - MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK - with_named_thread="-lpthread -lsocket" - # sched.h conflicts with fsu-threads - # touch ./include/sched.h - - AC_MSG_CHECKING("for gcc") - # We must have gcc - if expr "$CC" : ".*gcc.*" - then - AC_MSG_RESULT("yes") - else - AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.]); - fi - AC_MSG_RESULT("yes") - # Hack for SCO UnixWare 7.1.x - # - elif test "$with_named_thread" = "no" - then - AC_MSG_RESULT("no") - AC_MSG_CHECKING("SCO UnixWare 7.1.x native threads") - if expr "$SYSTEM_TYPE" : ".*sco.*" > /dev/null - then - if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so - then - MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK - if expr "$CC" : ".*gcc.*" - then - with_named_thread="-pthread -lsocket -lnsl" - else - with_named_thread="-Kthread -lsocket -lnsl" - fi - if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null - then - AC_DEFINE(HAVE_UNIXWARE7_THREADS) - else - AC_DEFINE(HAVE_UNIXWARE7_POSIX) - fi - AC_MSG_RESULT("yes") - # We must have cc - AC_MSG_CHECKING("for gcc") - if expr "$CC" : ".*gcc.*" - then - CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - else - CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - fi - else - { echo "configure: error: Can't find thread libs on SCO UnixWare7. See the Installation chapter in the Reference Manual." 1>&2; exit 1; }; - fi - else - AC_MSG_RESULT("no") - fi - else - AC_MSG_ERROR([On SCO UNIX MySQL requires that the FSUThreads package is installed. See the Installation chapter in the Reference Manual.]); - fi - else - AC_MSG_RESULT("no") - fi -fi -# Hack for SCO UnixWare7 -# -if test "$with_named_thread" = "no" -then - AC_MSG_CHECKING("SCO UnixWare7 native threads") - if expr "$SYSTEM_TYPE" : ".*UnixWare*" > /dev/null - then - if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so - then - MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK - if expr "$CC" : ".*gcc.*" - then - with_named_thread="-pthread -lsocket -lnsl" - else - with_named_thread="-Kthread -lsocket -lnsl" - fi - if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null - then - AC_DEFINE(HAVE_UNIXWARE7_THREADS) - else - AC_DEFINE(HAVE_UNIXWARE7_POSIX) - fi - # We must have cc - AC_MSG_CHECKING("for gcc") - if expr "$CC" : ".*gcc.*" - then - CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - else - CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - fi - AC_MSG_RESULT("yes") - else - { echo "configure: error: Can't find thread libs on SCO UnixWare7. See the Installation chapter in the Reference Manual." 1>&2; exit 1; }; - fi - else - AC_MSG_RESULT("no") - fi -fi - -# Hack for Caldera OpenUNIX8 -# -if test "$with_named_thread" = "no" -then - AC_MSG_CHECKING("OpenUNIX8 native threads") - if expr "$SYSTEM_TYPE" : ".*OpenUNIX*" > /dev/null - then - if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so - then - MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK - if expr "$CC" : ".*gcc.*" - then - with_named_thread="-pthread -lsocket -lnsl" - else - with_named_thread="-Kthread -lsocket -lnsl" - fi - if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null - then - AC_DEFINE(HAVE_UNIXWARE7_THREADS) - else - AC_DEFINE(HAVE_UNIXWARE7_POSIX) - fi - # We must have cc - AC_MSG_CHECKING("for gcc") - if expr "$CC" : ".*gcc.*" - then - CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - else - CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - fi - AC_MSG_RESULT("yes") - else - { echo "configure: error: Can't find thread libs on Caldera OpenUNIX 8. See the Installation chapter in the Reference Manual." 1>&2; exit 1; }; - fi - else - AC_MSG_RESULT("no") - fi -fi - -# Hack for Siemens UNIX -if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no" -then - AC_MSG_CHECKING("Siemens threads") - if test -f /usr/lib/libxnet.so -a "$SYSTEM_TYPE" = "sni-sysv4" - then - LIBS="-lxnet $LIBS" - NON_THREADED_CLIENT_LIBS="$NON_THREADED_CLIENT_LIBS -lxnet" - with_named_thread="-Kthread $LDFLAGS -lxnet" - LD_FLAGS="" - CFLAGS="-Kthread $CFLAGS" - CXXFLAGS="-Kthread $CXXFLAGS" - AC_MSG_RESULT("yes") - else - AC_MSG_RESULT("no") - fi -fi - -# Use library named -lpthread -if test "$with_named_thread" = "no" -a "$with_pthread" = "yes" -then - with_named_thread="-lpthread" -fi - -#---END: - -# Hack for Solaris >= 2.5 -# We want both the new and the old interface - -if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no" -then - AC_MSG_CHECKING("Solaris threads") - if test -f /usr/lib/libpthread.so -a -f /usr/lib/libthread.so - then - with_named_thread="-lpthread -lthread" - AC_MSG_RESULT("yes") - else - AC_MSG_RESULT("no") - fi -fi - -TOOLS_LIBS="$NON_THREADED_CLIENT_LIBS" - -# Should we use named pthread library ? -AC_MSG_CHECKING("named thread libs:") -if test "$with_named_thread" != "no" -then - LIBS="$with_named_thread $LIBS $with_named_thread" - TOOLS_LIBS="$with_named_thread $TOOLS_LIBS $with_named_thread" - with_posix_threads="yes" - with_mit_threads="no" - AC_MSG_RESULT("$with_named_thread") -else - AC_MSG_RESULT("no") - if test "$with_mit_threads" = "no" - then - # pthread_create is in standard libraries (As in BSDI 3.0) - AC_MSG_CHECKING("for pthread_create in -libc"); - AC_TRY_LINK( - [#include ], - [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], - with_posix_threads=yes, with_posix_threads=no) - AC_MSG_RESULT("$with_posix_threads") - if test "$with_posix_threads" = "no" - then - AC_MSG_CHECKING("for pthread_create in -lpthread"); - ac_save_LIBS="$LIBS" - ac_save_TOOLS_LIBS="$TOOLS_LIBS" - LIBS="$LIBS -lpthread" - TOOLS_LIBS="$TOOLS_LIBS -lpthread" - AC_TRY_LINK( - [#include ], - [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], - with_posix_threads=yes, with_posix_threads=no) - AC_MSG_RESULT("$with_posix_threads") - if test "$with_posix_threads" = "no" - then - LIBS=" $ac_save_LIBS -lpthreads" - TOOLS_LIBS=" $ac_save_TOOLS_LIBS -lpthreads" - AC_MSG_CHECKING("for pthread_create in -lpthreads"); - AC_TRY_LINK( - [#include ], - [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], - with_posix_threads=yes, with_posix_threads=no) - AC_MSG_RESULT("$with_posix_threads") - if test "$with_posix_threads" = "no" - then - # This is for FreeBSD - LIBS="$ac_save_LIBS -pthread" - TOOLS_LIBS="$ac_save_TOOLS_LIBS -pthread" - AC_MSG_CHECKING("for pthread_create in -pthread"); - AC_TRY_LINK( - [#include ], - [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], - with_posix_threads=yes, with_posix_threads=no) - AC_MSG_RESULT("$with_posix_threads") - if test "$with_posix_threads" = "no" - then - with_mit_threads="yes" - LIBS="$ac_save_LIBS" - TOOLS_LIBS="$ac_save_TOOLS_LIBS" - fi - fi - fi - fi - fi -fi - -#---START: Used in for client configure -# Must be checked after, because strtok_r may be in -lpthread -# On AIX strtok_r is in libc_r - -my_save_LIBS="$LIBS" -AC_CHECK_LIB(pthread,strtok_r) -LIBS="$my_save_LIBS" -if test "$ac_cv_lib_pthread_strtok_r" = "no" -then - AC_CHECK_LIB(c_r,strtok_r) - case "$with_osf32_threads---$target_os" in - # Don't keep -lc_r in LIBS; -pthread handles it magically - yes---* | *---freebsd* | *---hpux*) LIBS="$my_save_LIBS" ;; - - esac - AC_CHECK_FUNCS(strtok_r pthread_init) -else - AC_CHECK_FUNCS(strtok_r) -fi -#---END: - -# Check for dlopen, needed for user definable functions -# This must be checked after threads on AIX -# We only need this for mysqld, not for the clients. - -my_save_LIBS="$LIBS" -LIBS="" -AC_CHECK_LIB(dl,dlopen) -LIBDL=$LIBS -LIBS="$my_save_LIBS" -AC_SUBST(LIBDL) - -# System characteristics -case $SYSTEM_TYPE in - *netware* | *modesto*) ;; - *) -AC_SYS_RESTARTABLE_SYSCALLS - ;; -esac - -# Build optimized or debug version ? -# First check for gcc and g++ -if test "$ac_cv_prog_gcc" = "yes" -then - DEBUG_CFLAGS="-g" - DEBUG_OPTIMIZE_CC="-O" - OPTIMIZE_CFLAGS="$MAX_C_OPTIMIZE" -else - DEBUG_CFLAGS="-g" - DEBUG_OPTIMIZE_CC="" - OPTIMIZE_CFLAGS="-O" -fi -if test "$ac_cv_prog_cxx_g" = "yes" -then - DEBUG_CXXFLAGS="-g" - DEBUG_OPTIMIZE_CXX="-O" - OPTIMIZE_CXXFLAGS="$MAX_CXX_OPTIMIZE" -else - DEBUG_CXXFLAGS="-g" - DEBUG_OPTIMIZE_CXX="" - OPTIMIZE_CXXFLAGS="-O" -fi - -if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then - DEBUG_CFLAGS="$DEBUG_CFLAGS -DDEBUG -sym internal,codeview4" - DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -DDEBUG -sym internal,codeview4" - OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS -DNDEBUG" - OPTIMIZE_CXXFLAGS="$OPTIMIZE_CXXFLAGS -DNDEBUG" -fi - -AC_ARG_WITH(debug, - [ --without-debug Build a production version without debugging code], - [with_debug=$withval], - [with_debug=no]) -if test "$with_debug" = "yes" -then - # Medium debug. - CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS" - CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS" -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" -else - # Optimized version. No debug - CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS" - CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS" -fi - -# Force static compilation to avoid linking problems/get more speed -AC_ARG_WITH(mysqld-ldflags, - [ --with-mysqld-ldflags Extra linking arguments for mysqld], - [MYSQLD_EXTRA_LDFLAGS=$withval], - [MYSQLD_EXTRA_LDFLAGS=]) -AC_SUBST(MYSQLD_EXTRA_LDFLAGS) - -AC_ARG_WITH(client-ldflags, - [ --with-client-ldflags Extra linking arguments for clients], - [CLIENT_EXTRA_LDFLAGS=$withval], - [CLIENT_EXTRA_LDFLAGS=]) -AC_SUBST(CLIENT_EXTRA_LDFLAGS) - -AC_ARG_WITH(lib-ccflags, - [ --with-lib-ccflags Extra CC options for libraries], - [LIB_EXTRA_CCFLAGS=$withval], - [LIB_EXTRA_CCFLAGS=]) -AC_SUBST(LIB_EXTRA_CCFLAGS) - -# Avoid stupid bug on some OS -AC_ARG_WITH(low-memory, - [ --with-low-memory Try to use less memory to compile to avoid - memory limitations.], - [with_lowmem=$withval], - [with_lowmem=no]) -if test "$with_lowmem" = "yes" -then - if test "$ac_cv_prog_gcc" = "yes" - then - LM_CFLAGS="-fno-inline" - else - LM_CFLAGS="-O0" - fi -else - LM_CFLAGS="" -fi -AC_SUBST(LM_CFLAGS) - -AC_ARG_WITH(comment, - [ --with-comment Comment about compilation environment.], - [with_comment=$withval], - [with_comment=no]) -if test "$with_comment" != "no" -then - COMPILATION_COMMENT=$with_comment -else - COMPILATION_COMMENT="Source distribution" -fi -AC_SUBST(COMPILATION_COMMENT) - -AC_MSG_CHECKING("need of special linking flags") -if test "$IS_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes" -then - LDFLAGS="$LDFLAGS -rdynamic" - AC_MSG_RESULT("-rdynamic") -else - AC_MSG_RESULT("none") -fi - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_C_INLINE -AC_TYPE_OFF_T -AC_STRUCT_ST_RDEV -AC_HEADER_TIME -AC_STRUCT_TM -# AC_CHECK_SIZEOF return 0 when it does not find the size of a -# type. We want a error instead. -AC_CHECK_SIZEOF(char, 1) -if test "$ac_cv_sizeof_char" -eq 0 -then - AC_MSG_ERROR([No size for char type. -A likely cause for this could be that there isn't any -static libraries installed. You can verify this by checking if you have libm.a -in /lib, /usr/lib or some other standard place. If this is the problem, -install the static libraries and try again. If this isn't the problem, -examine config.log for possible errors. If you want to report this, use -'scripts/mysqlbug' and include at least the last 20 rows from config.log!]) -fi -AC_CHECK_SIZEOF(char*, 4) -AC_CHECK_SIZEOF(int, 4) -if test "$ac_cv_sizeof_int" -eq 0 -then - AC_MSG_ERROR("No size for int type.") -fi -AC_CHECK_SIZEOF(long, 4) -if test "$ac_cv_sizeof_long" -eq 0 -then - AC_MSG_ERROR("No size for long type.") -fi -AC_CHECK_SIZEOF(long long, 8) -if test "$ac_cv_sizeof_long_long" -eq 0 -then - AC_MSG_ERROR("MySQL needs a long long type.") -fi -# off_t is not a builtin type -MYSQL_CHECK_SIZEOF(off_t, 4) -if test "$ac_cv_sizeof_off_t" -eq 0 -then - AC_MSG_ERROR("MySQL needs a off_t type.") -fi -# This always gives a warning. Ignore it unless you are cross compiling -AC_C_BIGENDIAN -#---START: Used in for client configure -# Check base type of last arg to accept -MYSQL_TYPE_ACCEPT - -#---END: -# Find where the stack goes -MYSQL_STACK_DIRECTION -# We want to skip alloca on irix unconditionally. It may work on some version.. -MYSQL_FUNC_ALLOCA -# Do struct timespec have members tv_sec or ts_sec -MYSQL_TIMESPEC_TS -# Do we have the tzname variable -MYSQL_TZNAME -# Do the system files define ulong -MYSQL_CHECK_ULONG -# Do the system files define uchar -MYSQL_CHECK_UCHAR -# Do the system files define uint -MYSQL_CHECK_UINT -# Check for fp_except in ieeefp.h -MYSQL_CHECK_FP_EXCEPT -# Check for IN_ADDR_T -MYSQL_CHECK_IN_ADDR_T -# Do the c++ compiler have a bool type -MYSQL_CXX_BOOL -# Check some common bugs with gcc 2.8.# on sparc -if ! ( expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null ); then -MYSQL_CHECK_LONGLONG_TO_FLOAT -if test "$ac_cv_conv_longlong_to_float" != "yes" -then - AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float! -If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try -again]); -fi -fi -MYSQL_PTHREAD_YIELD - -###################################################################### -# For readline/libedit (We simply move the mimimum amount of stuff from -# the readline/libedit configure.in here) - -dnl Checks for header files. -AC_CHECK_HEADERS(malloc.h sys/cdefs.h) - -dnl Checks for library functions. -AC_FUNC_ALLOCA -AC_PROG_GCC_TRADITIONAL -AC_TYPE_SIGNAL -AC_CHECK_FUNCS(re_comp regcomp strdup) - -AC_CHECK_HEADERS(vis.h) -AC_CHECK_FUNCS(strlcat strlcpy) -AC_CHECK_FUNCS(issetugid) -AC_CHECK_FUNCS(fgetln) -AC_CHECK_FUNCS(getline flockfile) - -# from old readline settting: - -MAKE_SHELL=/bin/sh -AC_SUBST(MAKE_SHELL) - -# Already-done: stdlib.h string.h unistd.h termios.h -AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \ - sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \ - sys/mman.h curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h \ -paths.h semaphore.h) - -# Already-done: strcasecmp -AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr) - -AC_STAT_MACROS_BROKEN -MYSQL_SIGNAL_CHECK -MYSQL_CHECK_GETPW_FUNCS -MYSQL_HAVE_TIOCGWINSZ -MYSQL_HAVE_FIONREAD -MYSQL_HAVE_TIOCSTAT -MYSQL_STRUCT_DIRENT_D_INO -MYSQL_TYPE_SIGHANDLER -if test "$with_named_curses" = "no" -then - MYSQL_CHECK_LIB_TERMCAP -else - TERMCAP_LIB="$with_named_curses" -fi -AC_SUBST(TERMCAP_LIB) - -# End of readline/libedit stuff -######################################################################### - -dnl Checks for library functions. - -# -# The following code disables intrinsic function support while we test for -# library functions. This is to avoid configure problems with Intel ecc -# compiler - -ORG_CFLAGS="$CFLAGS" -if test "$GCC" != "yes"; then - AC_SYS_COMPILER_FLAG(-nolib_inline,nolib_inline,CFLAGS,[],[]) -fi - -AC_FUNC_MMAP -AC_TYPE_SIGNAL -MYSQL_TYPE_QSORT -AC_FUNC_UTIME_NULL -AC_FUNC_VPRINTF - -AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \ - fconvert fdatasync finite fpresetsticky fpsetmask fsync ftruncate \ - getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \ - getpwuid getrlimit getrusage getwd gmtime_r index initgroups isnan \ - localtime_r locking longjmp lrand48 madvise mallinfo memcpy memmove \ - mkstemp mlockall perror poll pread pthread_attr_create clock_gettime \ - pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \ - pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \ - pthread_key_delete pthread_rwlock_rdlock pthread_setprio \ - pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \ - realpath rename rint rwlock_init setupterm sighold sigset sigthreadmask \ - snprintf socket stpcpy strcasecmp strerror strnlen strpbrk strstr strtol \ - strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr) - -# isinf() could be a function or a macro (HPUX) -AC_MSG_CHECKING(for isinf with ) -AC_TRY_LINK([#include ], [float f = 0.0; isinf(f)], - AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ISINF,,[isinf() macro or function]), - AC_MSG_RESULT(no)) - -CFLAGS="$ORG_CFLAGS" - -# Sanity check: We chould not have any fseeko symbol unless -# large_file_support=yes -AC_CHECK_FUNC(fseeko, -[if test "$large_file_support" = no -a "$IS_LINUX" = "true"; -then - AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!"); -fi] -) - -my_save_LIBS="$LIBS" -LIBS="$LIBS $LIBDL" -AC_CHECK_FUNCS(dlopen dlerror) -LIBS="$my_save_LIBS" - -# Check definition of gethostbyaddr_r (glibc2 defines this with 8 arguments) -ac_save_CXXFLAGS="$CXXFLAGS" -AC_CACHE_CHECK([style of gethost* routines], mysql_cv_gethost_style, -AC_LANG_SAVE -AC_LANG_CPLUSPLUS - -# Do not treat warnings as errors if we are linking against other libc -# this is to work around gcc not being permissive on non-system includes -# with respect to ANSI C++ -# We also remove the -fbranch-probabilities option as this will give warnings -# about not profiled code, which confuses configure -if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no" -then - CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed 's/-fbranch-probabilities//'` -fi - -AC_TRY_COMPILE( -[#undef inline -#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT) -#define _REENTRANT -#endif -#include -#include -#include -#include -#include -#include ], -[int skr; - struct hostent *foo = gethostbyaddr_r((const char *) 0, - 0, 0, (struct hostent *) 0, (char *) NULL, 0, &skr); return (foo == 0);], -mysql_cv_gethost_style=solaris, mysql_cv_gethost_style=other)) -AC_LANG_RESTORE -CXXFLAGS="$ac_save_CXXFLAGS" -if test "$mysql_cv_gethost_style" = "solaris" -then - AC_DEFINE(HAVE_SOLARIS_STYLE_GETHOST) -fi - -#---START: Used in for client configure - -# Check definition of gethostbyname_r (glibc2.0.100 is different from Solaris) -ac_save_CXXFLAGS="$CXXFLAGS" -AC_CACHE_CHECK([style of gethostname_r routines], mysql_cv_gethostname_style, -AC_LANG_SAVE -AC_LANG_CPLUSPLUS -if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no" -then - CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed 's/-fbranch-probabilities//'` -fi -AC_TRY_COMPILE( -[#undef inline -#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT) -#define _REENTRANT -#endif -#include -#include -#include -#include -#include -#include ], -[int skr; - - skr = gethostbyname_r((const char *) 0, - (struct hostent*) 0, (char*) 0, 0, (struct hostent **) 0, &skr);], -mysql_cv_gethostname_style=glibc2, mysql_cv_gethostname_style=other)) -AC_LANG_RESTORE -CXXFLAGS="$ac_save_CXXFLAGS" -if test "$mysql_cv_gethostname_style" = "glibc2" -then - AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) -fi - -# Check 3rd argument of getthostbyname_r -ac_save_CXXFLAGS="$CXXFLAGS" -AC_CACHE_CHECK([3 argument to gethostname_r routines], mysql_cv_gethostname_arg, -AC_LANG_SAVE -AC_LANG_CPLUSPLUS -if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no" -then - CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed 's/-fbranch-probabilities//'` -fi -AC_TRY_COMPILE( -[#undef inline -#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT) -#define _REENTRANT -#endif -#include -#include -#include -#include -#include -#include ], -[int skr; - - skr = gethostbyname_r((const char *) 0, (struct hostent*) 0, (struct hostent_data*) 0);], -mysql_cv_gethostname_arg=hostent_data, mysql_cv_gethostname_arg=char)) -AC_LANG_RESTORE -CXXFLAGS="$ac_save_CXXFLAGS" -if test "$mysql_cv_gethostname_arg" = "hostent_data" -then - AC_DEFINE(HAVE_GETHOSTBYNAME_R_RETURN_INT) -fi - - -if test "$with_mit_threads" = "no" -then - # Check definition of pthread_getspecific - AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args, - AC_TRY_COMPILE( -[#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT) -#define _REENTRANT -#endif -#define _POSIX_PTHREAD_SEMANTICS -#include ], -[ void *pthread_getspecific(pthread_key_t key); -pthread_getspecific((pthread_key_t) NULL); ], -mysql_cv_getspecific_args=POSIX, mysql_cv_getspecific_args=other)) - if test "$mysql_cv_getspecific_args" = "other" - then - AC_DEFINE(HAVE_NONPOSIX_PTHREAD_GETSPECIFIC) - fi - - # Check definition of pthread_mutex_init - AC_CACHE_CHECK("args to pthread_mutex_init", mysql_cv_mutex_init_args, - AC_TRY_COMPILE( -[#if !defined(SCO) && !defined(__osf__) -#define _REENTRANT -#endif -#define _POSIX_PTHREAD_SEMANTICS -#include ], -[ - pthread_mutexattr_t attr; - pthread_mutex_t mp; - pthread_mutex_init(&mp,&attr); ], -mysql_cv_mutex_init_args=POSIX, mysql_cv_mutex_init_args=other)) - if test "$mysql_cv_mutex_init_args" = "other" - then - AC_DEFINE(HAVE_NONPOSIX_PTHREAD_MUTEX_INIT) - fi -fi -#---END: - -#---START: Used in for client configure -# Check definition of readdir_r -AC_CACHE_CHECK("args to readdir_r", mysql_cv_readdir_r, -AC_TRY_LINK( -[#if !defined(SCO) && !defined(__osf__) -#define _REENTRANT -#endif -#define _POSIX_PTHREAD_SEMANTICS -#include -#include ], -[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); -readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ], -mysql_cv_readdir_r=POSIX, mysql_cv_readdir_r=other)) -if test "$mysql_cv_readdir_r" = "POSIX" -then - AC_DEFINE(HAVE_READDIR_R) -fi - -# Check definition of posix sigwait() -AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait, -AC_TRY_LINK( -[#if !defined(SCO) && !defined(__osf__) -#define _REENTRANT -#endif -#define _POSIX_PTHREAD_SEMANTICS -#include -#include ], -[#ifndef _AIX -sigset_t set; -int sig; -sigwait(&set,&sig); -#endif], -mysql_cv_sigwait=POSIX, mysql_cv_sigwait=other)) -if test "$mysql_cv_sigwait" = "POSIX" -then - AC_DEFINE(HAVE_SIGWAIT) -fi - -if test "$mysql_cv_sigwait" != "POSIX" -then -unset mysql_cv_sigwait -# Check definition of posix sigwait() -AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait, -AC_TRY_LINK( -[#if !defined(SCO) && !defined(__osf__) -#define _REENTRANT -#endif -#define _POSIX_PTHREAD_SEMANTICS -#include -#include ], -[sigset_t set; -int sig; -sigwait(&set);], -mysql_cv_sigwait=NONPOSIX, mysql_cv_sigwait=other)) -if test "$mysql_cv_sigwait" = "NONPOSIX" -then - AC_DEFINE(HAVE_NONPOSIX_SIGWAIT) -fi -fi -#---END: - -# Check if pthread_attr_setscope() exists -AC_CACHE_CHECK("for pthread_attr_setscope", mysql_cv_pthread_attr_setscope, -AC_TRY_LINK( -[#if !defined(SCO) && !defined(__osf__) -#define _REENTRANT -#endif -#define _POSIX_PTHREAD_SEMANTICS -#include ], -[pthread_attr_t thr_attr; -pthread_attr_setscope(&thr_attr,0);], -mysql_cv_pthread_attr_setscope=yes, mysql_cv_pthread_attr_setscope=no)) -if test "$mysql_cv_pthread_attr_setscope" = "yes" -then - AC_DEFINE(HAVE_PTHREAD_ATTR_SETSCOPE) -fi - -# Check for bad includes -AC_MSG_CHECKING("can netinet files be included") -AC_TRY_COMPILE( -[#include -#include -#include -#include -#include -#include ], -[ printf("1\n"); ], -netinet_inc=yes, netinet_inc=no) -if test "$netinet_inc" = "no" -then - AC_DEFINE(HAVE_BROKEN_NETINET_INCLUDES) -fi -AC_MSG_RESULT("$netinet_inc") - -# Some usefull subst -AC_SUBST(CC) -AC_SUBST(GXX) - -# Output results -AC_OUTPUT(Makefile dnl - , , [ - test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h - ]) diff --git a/ndb/config/type_kernel.mk.am b/ndb/config/type_kernel.mk.am index c389a64b936..703876ee2e9 100644 --- a/ndb/config/type_kernel.mk.am +++ b/ndb/config/type_kernel.mk.am @@ -1,2 +1,18 @@ -INCLUDES += @NDB_KERNEL_INCLUDES@ +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 + +#AM_LDFLAGS = @ndb_ldflags@ diff --git a/ndb/config/type_mgmapiclient.mk.am b/ndb/config/type_mgmapiclient.mk.am index f3bebb2c756..1ef4a81d67e 100644 --- a/ndb/config/type_mgmapiclient.mk.am +++ b/ndb/config/type_mgmapiclient.mk.am @@ -1,2 +1,2 @@ -INCLUDES += @NDB_MGMAPICLIENT_INCLUDES@ +INCLUDES += -I$(top_srcdir)/ndb/include/mgmapi diff --git a/ndb/config/type_ndbapi.mk.am b/ndb/config/type_ndbapi.mk.am index 864690cec7b..ed648273aea 100644 --- a/ndb/config/type_ndbapi.mk.am +++ b/ndb/config/type_ndbapi.mk.am @@ -1,2 +1,12 @@ -INCLUDES += @NDB_NDBAPI_INCLUDES@ +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 diff --git a/ndb/config/type_ndbapiclient.mk.am b/ndb/config/type_ndbapiclient.mk.am index f9655ff9876..88b57e49e19 100644 --- a/ndb/config/type_ndbapiclient.mk.am +++ b/ndb/config/type_ndbapiclient.mk.am @@ -1,2 +1,2 @@ -INCLUDES += @NDB_NDBAPICLIENT_INCLUDES@ +INCLUDES += -I$(top_srcdir)/ndb/include/ndbapi diff --git a/ndb/config/type_ndbapitest.mk.am b/ndb/config/type_ndbapitest.mk.am index 8aa92ceb6a7..3132dd30f0b 100644 --- a/ndb/config/type_ndbapitest.mk.am +++ b/ndb/config/type_ndbapitest.mk.am @@ -1,6 +1,11 @@ -AM_LDFLAGS = -rpath @ndblibdir@ -LDADD += $(top_srcdir)/ndb/test/src/libNDBT.a \ - $(top_srcdir)/ndb/src/libndbclient.la +LDADD += $(top_builddir)/ndb/test/src/libNDBT.a \ + $(top_builddir)/ndb/src/libndbclient.la -INCLUDES += @NDB_NDBAPITEST_INCLUDES@ +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 diff --git a/ndb/config/type_ndbapitools.mk.am b/ndb/config/type_ndbapitools.mk.am index ac302ae9eb4..a8b511d3637 100644 --- a/ndb/config/type_ndbapitools.mk.am +++ b/ndb/config/type_ndbapitools.mk.am @@ -1,5 +1,10 @@ -LDADD += $(top_srcdir)/ndb/test/src/libNDBT.a \ - $(top_srcdir)/ndb/src/.libs/libndbclient.a +LDADD += $(top_builddir)/ndb/src/libndbclient.la -INCLUDES += @NDB_NDBAPITEST_INCLUDES@ +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 diff --git a/ndb/config/type_util.mk.am b/ndb/config/type_util.mk.am index 4a3740ff811..0dfa77b7a7c 100644 --- a/ndb/config/type_util.mk.am +++ b/ndb/config/type_util.mk.am @@ -1,2 +1,6 @@ -INCLUDES += @NDB_UTIL_INCLUDES@ +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 diff --git a/ndb/configure_old b/ndb/configure_old deleted file mode 100755 index f0fc197f45e..00000000000 --- a/ndb/configure_old +++ /dev/null @@ -1,33 +0,0 @@ -#! /bin/sh - -if [ $# -gt 0 -a "$1" = "-p" ] -then - shift - NDB_TOP=$1 - shift -else - NDB_TOP=`pwd` -fi - -cd $NDB_TOP -NDB_TOP=`pwd` - -for i in `find . -name 'Makefile' -exec dirname {} \;` -do - cd $i - rel_path=. - while [ $NDB_TOP != `pwd` ] - do - rel_path=$rel_path"/.." - cd .. - done - - ( - echo "NDB_TOP=$rel_path" - echo "include $rel_path/Defs.mk" - ) > $i/.defs.mk -done - -( cd config ; aclocal ; automake ; aclocal ; autoconf ; ./configure ) -export NDB_TOP -. config/GuessConfig.sh $* diff --git a/ndb/docs/Makefile b/ndb/docs/Makefile deleted file mode 100644 index a2139b66044..00000000000 --- a/ndb/docs/Makefile +++ /dev/null @@ -1,97 +0,0 @@ -include .defs.mk -# -# hack before full autoconf -replace-targets := all clean -first-docs: all - -include $(NDB_TOP)/Epilogue.mk - -all: ndbapidoc mgmapidoc - -DOXYGEN = doxygen -DOXYTOP = $(shell cd $(NDB_TOP); pwd)/docs -DOXYDIR = $(DOXYTOP)/doxygen -DOXYTMP = $(DOXYTOP)/.doxytmp -DOXYOUT = $(DOXYTOP)/.doxyout - -clean: - rm -rf ndbapi.pdf ndbapi.html mgmapi.pdf mgmapi.html - rm -rf $(DOXYTMP) $(DOXYOUT) - -### -# -# NDB API Programmer's Guide -# -ndbapidoc: ndbapi.pdf - -ndbapi.pdf: $(NDB_TOP)/include/ndb_version.h - @set -x; \ - rm -rf ndbapi.pdf ndbapi.html; \ - rm -rf $(DOXYTMP) $(DOXYOUT); \ - mkdir -p $(DOXYTMP) $(DOXYOUT); \ - (cd $(NDB_TOP)/include/ndbapi && \ - find . -type f -print | \ - grep -v /SCCS | \ - cpio -pdm $(DOXYTMP)); \ - (cd $(NDB_TOP)/examples && \ - cp -p */*.[ch]pp $(DOXYTMP)); \ - $(DOXYDIR)/predoxy.pl; \ - mv footer.html $(DOXYTMP); \ - (cd $(DOXYTMP) && \ - $(DOXYGEN) $(DOXYDIR)/Doxyfile.ndbapi); \ - $(DOXYDIR)/postdoxy.pl $(DOXYOUT)/ndbapi.latex "NDB API Programmer Guide"; \ - (cd $(DOXYOUT) && \ - find ndbapi.html -print | cpio -pdm $(DOXYTOP)); \ - (cd $(DOXYOUT)/ndbapi.latex && \ - pdflatex refman.tex && makeindex refman && pdflatex refman.tex && \ - cp -p refman.pdf $(DOXYTOP)/ndbapi.pdf); - -### -# -# MGM API Guide -# -mgmapidoc: mgmapi.pdf - -mgmapi.pdf: $(NDB_TOP)/include/ndb_version.h - @set -x; \ - rm -rf mgmapi.pdf mgmapi.html; \ - rm -rf $(DOXYTMP) $(DOXYOUT); \ - mkdir -p $(DOXYTMP) $(DOXYOUT); \ - (cd $(NDB_TOP)/include/mgmapi && \ - find . -type f -print | \ - grep -v /SCCS | \ - cpio -pdm $(DOXYTMP)); \ - $(DOXYDIR)/predoxy.pl; \ - mv footer.html $(DOXYTMP); \ - (cd $(DOXYTMP) && \ - $(DOXYGEN) $(DOXYDIR)/Doxyfile.mgmapi); \ - $(DOXYDIR)/postdoxy.pl $(OUTDIR)/mgmapi.latex "NDB Cluster MGM API Guide"; \ - (cd $(DOXYOUT) && \ - find mgmapi.html -print | cpio -pdm $(DOXYTOP)); \ - (cd $(DOXYOUT)/mgmapi.latex && \ - pdflatex refman.tex && makeindex refman && pdflatex refman.tex && \ - cp -p refman.pdf $(DOXYTOP)/mgmapi.pdf); - -### -# -# Complete Source Browser except for -# ndbapi odbc test tools win32 lib examples docs CVS config bin -# include/ndbapi -# include/newtonapi src/newtonapi -# include/mgmapi src/mgmapi -# src/client -ndbdoc: DUMMY - mkdir -p $(OUTDIR) - cd $(NDB_TOP) ; $(DOXYGEN) $(DOXYDIR)/Doxyfile.ndb - -### -# -# odbcdoc - Complete Source Browser for NDB ODBC (src/client/odbc) - -odbcdoc: DUMMY - mkdir -p $(OUTDIR) - cd $(NDB_TOP) ; $(DOXYGEN) $(DOXYDIR)/Doxyfile.odbc - -testdoc: DUMMY - mkdir -p $(OUTDIR) - cd $(NDB_TOP) ; $(DOXYGEN) $(DOXYDIR)/Doxyfile.test diff --git a/ndb/docs/Makefile.am b/ndb/docs/Makefile.am new file mode 100644 index 00000000000..fb367fb9345 --- /dev/null +++ b/ndb/docs/Makefile.am @@ -0,0 +1,101 @@ + +all: do-check ndbapidoc mgmapidoc + +DOXYDIR = doxygen +DOXYTMP = .doxytmp +DOXYOUT = .doxyout + +NDB_RELEASE = @NDB_VERSION_MAJOR@.@NDB_VERSION_MINOR@.@NDB_VERSION_BUILD@-@NDB_VERSION_STATUS@ + +clean: + rm -rf ndbapi.pdf ndbapi.html mgmapi.pdf mgmapi.html + rm -rf $(DOXYTMP) $(DOXYOUT) + +do-check: + @set -x; \ + if test @PERL@ = no ; then \ + echo "Perl needed to make docs"; \ + exit 1; \ + fi; \ + if test @DOXYGEN@ = no ; then \ + echo "Doxygen needed to make docs"; \ + exit 1; \ + fi; \ + if test @PDFLATEX@ = no ; then \ + echo "Pdflatex needed to make docs"; \ + exit 1; \ + fi; \ + if test @MAKEINDEX@ = no ; then \ + echo "Makeindex needed to make docs"; \ + exit 1; \ + fi; +### +# +# NDB API Programmer's Guide +# +ndbapidoc: ndbapi.pdf + +ndbapi.pdf: $(top_srcdir)/ndb/include/ndb_version.h + @set -x; \ + export NDB_RELEASE=$(NDB_RELEASE) \ + @RM@ -f ndbapi.pdf ndbapi.html; \ + @RM@ -rf $(DOXYTMP) $(DOXYOUT); \ + mkdir -p $(DOXYTMP) $(DOXYOUT); \ + @CP@ $(top_srcdir)/ndb/include/ndbapi/* $(DOXYTMP); \ + @CP@ $(top_srcdir)/ndb/examples/*/*.[ch]pp $(DOXYTMP); \ + @PERL@ $(DOXYDIR)/predoxy.pl; \ + mv footer.html $(DOXYTMP); \ + (cd $(DOXYTMP) ; @DOXYGEN@ ../$(DOXYDIR)/Doxyfile.ndbapi); \ + @PERL@ $(DOXYDIR)/postdoxy.pl $(DOXYOUT)/ndbapi.latex "NDB API Programmer Guide"; \ + (cd $(DOXYOUT) && \ + find ndbapi.html -print | cpio -pdm ..); \ + (cd $(DOXYOUT)/ndbapi.latex && \ + @PDFLATEX@ refman.tex && @MAKEINDEX@ refman && @PDFLATEX@ refman.tex && \ + cp -p refman.pdf ../../ndbapi.pdf); + +### +# +# MGM API Guide +# +mgmapidoc: mgmapi.pdf + +mgmapi.pdf: $(top_srcdir)/ndb/include/ndb_version.h + @set -x; \ + export NDB_RELEASE=$(NDB_RELEASE) \ + @RM@ -f mgmapi.pdf mgmapi.html; \ + @RM@ -rf $(DOXYTMP) $(DOXYOUT); \ + mkdir -p $(DOXYTMP) $(DOXYOUT); \ + @CP@ $(top_srcdir)/ndb/include/mgmapi/* $(DOXYTMP); \ + @PERL@ $(DOXYDIR)/predoxy.pl; \ + mv footer.html $(DOXYTMP); \ + (cd $(DOXYTMP) ; @DOXYGEN@ ../$(DOXYDIR)/Doxyfile.mgmapi); \ + @PERL@ $(DOXYDIR)/postdoxy.pl $(DOXYOUT)/mgmapi.latex "NDB Cluster MGM API Guide"; \ + (cd $(DOXYOUT) && \ + find mgmapi.html -print | cpio -pdm ..); \ + (cd $(DOXYOUT)/mgmapi.latex && \ + @PDFLATEX@ refman.tex && @MAKEINDEX@ refman && @PDFLATEX@ refman.tex && \ + cp -p refman.pdf ../../mgmapi.pdf); + +### +# +# Complete Source Browser except for +# ndbapi odbc test tools win32 lib examples docs CVS config bin +# include/ndbapi +# include/newtonapi src/newtonapi +# include/mgmapi src/mgmapi +# src/client +ndbdoc: DUMMY + mkdir -p $(OUTDIR) + cd $(top_srcdir)/ndb ; $(DOXYGEN) $(DOXYDIR)/Doxyfile.ndb + +### +# +# odbcdoc - Complete Source Browser for NDB ODBC (src/client/odbc) + +odbcdoc: DUMMY + mkdir -p $(OUTDIR) + cd $(top_srcdir)/ndb ; $(DOXYGEN) $(DOXYDIR)/Doxyfile.odbc + +testdoc: DUMMY + mkdir -p $(OUTDIR) + cd $(top_srcdir)/ndb ; $(DOXYGEN) $(DOXYDIR)/Doxyfile.test diff --git a/ndb/docs/doxygen/postdoxy.pl b/ndb/docs/doxygen/postdoxy.pl index 95062d1899f..ad0edb44a31 100755 --- a/ndb/docs/doxygen/postdoxy.pl +++ b/ndb/docs/doxygen/postdoxy.pl @@ -1,4 +1,3 @@ -#!/usr/local/bin/perl # # Written by Lars Thalmann, lars@mysql.com, 2003. # diff --git a/ndb/docs/doxygen/predoxy.pl b/ndb/docs/doxygen/predoxy.pl index 461ad02478a..8dad1d964d0 100755 --- a/ndb/docs/doxygen/predoxy.pl +++ b/ndb/docs/doxygen/predoxy.pl @@ -1,4 +1,3 @@ -#!/usr/local/bin/perl # # Written by Lars Thalmann, lars@mysql.com, 2003. # diff --git a/ndb/env.sh b/ndb/env.sh deleted file mode 100644 index c84a61b2c6f..00000000000 --- a/ndb/env.sh +++ /dev/null @@ -1,8 +0,0 @@ -# - -NDB_TOP=`pwd` -export NDB_TOP - -NDB_PROJ_HOME=$NDB_TOP/home -export NDB_PROJ_HOME - diff --git a/ndb/include/Makefile.am b/ndb/include/Makefile.am new file mode 100644 index 00000000000..e4c82cc161f --- /dev/null +++ b/ndb/include/Makefile.am @@ -0,0 +1,41 @@ + +include $(top_srcdir)/ndb/config/common.mk.am + +ndbinclude_HEADERS = \ +ndb_types.h \ +ndb_version.h + +ndbapiinclude_HEADERS = \ +ndbapi/ndbapi_limits.h \ +ndbapi/Ndb.hpp \ +ndbapi/NdbApi.hpp \ +ndbapi/NdbConnection.hpp \ +ndbapi/NdbCursorOperation.hpp \ +ndbapi/NdbDictionary.hpp \ +ndbapi/NdbError.hpp \ +ndbapi/NdbEventOperation.hpp \ +ndbapi/NdbIndexOperation.hpp \ +ndbapi/NdbOperation.hpp \ +ndbapi/NdbPool.hpp \ +ndbapi/NdbRecAttr.hpp \ +ndbapi/NdbReceiver.hpp \ +ndbapi/NdbResultSet.hpp \ +ndbapi/NdbScanFilter.hpp \ +ndbapi/NdbScanOperation.hpp \ +ndbapi/ndberror.h + +mgmapiinclude_HEADERS = \ +mgmapi/mgmapi.h \ +mgmapi/mgmapi_debug.h + +noinst_HEADERS = \ +ndb_global.h \ +ndb_net.h \ +mgmapi/mgmapi_config_parameters.h \ +mgmapi/mgmapi_config_parameters_debug.h + +EXTRA_DIST = debugger editline kernel logger mgmcommon \ +portlib transporter util + +dist-hook: + -rm -rf `find $(distdir) -type d -name SCCS` diff --git a/ndb/include/kernel/signaldata/TcKeyConf.hpp b/ndb/include/kernel/signaldata/TcKeyConf.hpp index bfd684b4af4..c133368bcbc 100644 --- a/ndb/include/kernel/signaldata/TcKeyConf.hpp +++ b/ndb/include/kernel/signaldata/TcKeyConf.hpp @@ -111,7 +111,7 @@ inline void TcKeyConf::setNoOfOperations(Uint32 & confInfo, Uint32 noOfOps){ ASSERT_MAX(noOfOps, 65535, "TcKeyConf::setNoOfOperations"); - confInfo |= noOfOps; + confInfo = (confInfo & 0xFFFF) | noOfOps; } inline diff --git a/ndb/include/ndb_version.h b/ndb/include/ndb_version.h index 9bb6af59590..56362020ebf 100644 --- a/ndb/include/ndb_version.h +++ b/ndb/include/ndb_version.h @@ -17,19 +17,11 @@ #ifndef NDB_VERSION_H #define NDB_VERSION_H +#include #include #define MAKE_VERSION(A,B,C) (((A) << 16) | ((B) << 8) | ((C) << 0)) -/** - * version of this build - */ - -#define NDB_VERSION_MAJOR 3 -#define NDB_VERSION_MINOR 5 -#define NDB_VERSION_BUILD 0 -#define NDB_VERSION_STATUS "alpha" - #define NDB_VERSION_D MAKE_VERSION(NDB_VERSION_MAJOR, NDB_VERSION_MINOR, NDB_VERSION_BUILD) #define NDB_VERSION_STRING (getVersionString(NDB_VERSION, NDB_VERSION_STATUS)) diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp index a8a3bc86786..4dd74e15008 100644 --- a/ndb/include/ndbapi/NdbDictionary.hpp +++ b/ndb/include/ndbapi/NdbDictionary.hpp @@ -298,6 +298,11 @@ public: */ int getLength() const; + /** + * Get size of element + */ + int Column::getSize() const; + /** * Set distribution key * @@ -349,6 +354,7 @@ public: #endif private: + friend class NdbRecAttr; friend class NdbColumnImpl; class NdbColumnImpl & m_impl; Column(NdbColumnImpl&); @@ -1030,4 +1036,6 @@ public: }; }; +class NdbOut& operator <<(class NdbOut& ndbout, const NdbDictionary::Column::Type type); + #endif diff --git a/ndb/include/ndbapi/NdbRecAttr.hpp b/ndb/include/ndbapi/NdbRecAttr.hpp index 30bb7753413..da03df13027 100644 --- a/ndb/include/ndbapi/NdbRecAttr.hpp +++ b/ndb/include/ndbapi/NdbRecAttr.hpp @@ -20,7 +20,6 @@ #include class NdbOperation; -class AttrInfo; /** * @class NdbRecAttr @@ -78,7 +77,8 @@ class NdbRecAttr friend class NdbEventOperationImpl; friend class NdbReceiver; friend class Ndb; - + friend class NdbOut& operator<<(class NdbOut&, const class AttributeS&); + public: /** * @name Getting meta information @@ -254,7 +254,7 @@ private: void next(NdbRecAttr* aRecAttr); NdbRecAttr* next() const; - + int setup(const class NdbDictionary::Column* col, char* aValue); int setup(const class NdbColumnImpl* anAttrInfo, char* aValue); /* Set up attributes and buffers */ bool copyoutRequired() const; /* Need to copy data to application */ @@ -442,5 +442,7 @@ NdbRecAttr::isNULL() const return theNULLind; } +class NdbOut& operator <<(class NdbOut&, const NdbRecAttr &); + #endif diff --git a/ndb/include/util/Parser.hpp b/ndb/include/util/Parser.hpp index 9c2f02b6024..65cf24db633 100644 --- a/ndb/include/util/Parser.hpp +++ b/ndb/include/util/Parser.hpp @@ -165,6 +165,7 @@ Parser::Parser(const ParserRow rows[], class InputStream & in, template inline Parser::~Parser(){ + delete impl; } template diff --git a/ndb/mysqlclusterenv.sh b/ndb/mysqlclusterenv.sh deleted file mode 100644 index e151186d01e..00000000000 --- a/ndb/mysqlclusterenv.sh +++ /dev/null @@ -1,51 +0,0 @@ -# Sets necessary environment variables for mysqlcluster install scripts -mytop= -if [ -f bin/mysql ]; then - mytop=`/bin/pwd` -elif [ -f bin/ndb ]; then - mytop=`dirname \`/bin/pwd\`` -fi -if [ "$mytop" ]; then - MYSQLCLUSTER_TOP=$mytop - PATH=$MYSQLCLUSTER_TOP/bin:$MYSQLCLUSTER_TOP/ndb/bin:$PATH - LD_LIBRARY_PATH=$MYSQLCLUSTER_TOP/lib:$LD_LIBRARY_PATH - LD_LIBRARY_PATH=$MYSQLCLUSTER_TOP/ndb/lib:$LD_LIBRARY_PATH - export MYSQLCLUSTER_TOP PATH LD_LIBRARY_PATH -else -if [ -d SCCS ]; then -if [ -f ndb/mysqlclusterenv.sh ]; then - mytop=`/bin/pwd` -elif [ -f mysqlclusterenv.sh ]; then - mytop=`dirname \`/bin/pwd\`` -fi -fi -if [ "$mytop" ]; then -# we're in the development tree - if [ "$REAL_EMAIL" ]; then :; else -#Guessing REAL_EMAIL - REAL_EMAIL=`whoami`@mysql.com - export REAL_EMAIL - echo Setting REAL_EMAIL=$REAL_EMAIL - fi - - MYSQLCLUSTER_TOP=$mytop - - NDB_TOP=$MYSQLCLUSTER_TOP/ndb - export NDB_TOP - - NDB_PROJ_HOME=$NDB_TOP/home - export NDB_PROJ_HOME - - PATH=$MYSQLCLUSTER_TOP/ndb/bin:$MYSQLCLUSTER_TOP/ndb/home/bin:$PATH - PATH=$MYSQLCLUSTER_TOP/client:$PATH - PATH=$MYSQLCLUSTER_TOP/sql:$PATH - LD_LIBRARY_PATH=$MYSQLCLUSTER_TOP/libmysql:$LD_LIBRARY_PATH - LD_LIBRARY_PATH=$MYSQLCLUSTER_TOP/libmysqld:$LD_LIBRARY_PATH - LD_LIBRARY_PATH=$MYSQLCLUSTER_TOP/ndb/lib:$LD_LIBRARY_PATH - LD_LIBRARY_PATH=$MYSQLCLUSTER_TOP/libmysql_r/.libs:$LD_LIBRARY_PATH - export MYSQLCLUSTER_TOP PATH LD_LIBRARY_PATH -else - echo "Please source this file (mysqlclusterenv.sh) from installation top directory" -fi -fi -mytop= diff --git a/ndb/src/Makefile.am b/ndb/src/Makefile.am index 08c5624038f..bed43438e91 100644 --- a/ndb/src/Makefile.am +++ b/ndb/src/Makefile.am @@ -1,18 +1,18 @@ SUBDIRS = common mgmapi ndbapi . kernel mgmsrv mgmclient cw +include $(top_srcdir)/ndb/config/common.mk.am + ndblib_LTLIBRARIES = libndbclient.la libndbclient_la_SOURCES = libndbclient_la_LIBADD = \ - $(top_srcdir)/ndb/src/ndbapi/libndbapi.la \ - $(top_srcdir)/ndb/src/common/transporter/libtransporter.la \ - $(top_srcdir)/ndb/src/common/debugger/libtrace.la \ - $(top_srcdir)/ndb/src/common/debugger/signaldata/libsignaldataprint.la \ - $(top_srcdir)/ndb/src/common/mgmcommon/libmgmsrvcommon.la \ - $(top_srcdir)/ndb/src/mgmapi/libmgmapi.la \ - $(top_srcdir)/ndb/src/common/logger/liblogger.la \ - $(top_srcdir)/ndb/src/common/portlib/unix/libportlib.la \ - $(top_srcdir)/ndb/src/common/util/libgeneral.la - -AM_LDFLAGS = -rpath @ndblibdir@ + ndbapi/libndbapi.la \ + common/transporter/libtransporter.la \ + common/debugger/libtrace.la \ + common/debugger/signaldata/libsignaldataprint.la \ + common/mgmcommon/libmgmsrvcommon.la \ + mgmapi/libmgmapi.la \ + common/logger/liblogger.la \ + common/portlib/libportlib.la \ + common/util/libgeneral.la diff --git a/ndb/src/Makefile_old b/ndb/src/Makefile_old deleted file mode 100644 index cd33563ddc1..00000000000 --- a/ndb/src/Makefile_old +++ /dev/null @@ -1,33 +0,0 @@ -include .defs.mk - -DIRS := \ - client \ - common \ - kernel \ - ndbapi \ - mgmsrv \ - mgmapi \ - newtonapi \ - rep \ - mgmclient \ - cw \ - ndbbaseclient -ifneq ($(NDB_ODBC),N) - DIRS += ndbclient -endif -ifeq ($(findstring OSE, $(NDB_OS)),) - DIRS += scripts -endif -include $(NDB_TOP)/Epilogue.mk - -_bins_mgmsrv: _libs_ndbapi -_bins_mgmsrv: _libs_mgmapi -_bins_mgmclient: _libs_mgmapi -_bins_mgmclient: _libs_common -_bins_client: _bins_ndbapi -_bins_common: _bins_mgmapi -_bins_kernel: _bins_ndbapi -_bins_newtonapi: _bins_ndbapi -_bins_mgmapi : _libs_common -_bins_rep: _libs_common -_bins_rep: _libs_ndbapi diff --git a/ndb/src/common/Makefile.am b/ndb/src/common/Makefile.am index 9ccf6f4350c..7fcf2cab636 100644 --- a/ndb/src/common/Makefile.am +++ b/ndb/src/common/Makefile.am @@ -8,6 +8,6 @@ libcommon_la_LIBADD = \ debugger/libtrace.la \ debugger/signaldata/libsignaldataprint.la \ mgmcommon/libmgmsrvcommon.la \ - portlib/unix/libportlib.la \ + portlib/libportlib.la \ logger/liblogger.la \ util/libgeneral.la diff --git a/ndb/src/common/mgmcommon/ConfigInfo.cpp b/ndb/src/common/mgmcommon/ConfigInfo.cpp index 57d1a2fe8fd..1766fbe967f 100644 --- a/ndb/src/common/mgmcommon/ConfigInfo.cpp +++ b/ndb/src/common/mgmcommon/ConfigInfo.cpp @@ -602,7 +602,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT64, 3000 * 8192, 128 * 8192, - 192000 * 8192 }, + ((Uint64)192000) * ((Uint64)8192) }, { KEY_INTERNAL, @@ -638,7 +638,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ConfigInfo::INT64, 10000 * 8192, 128 * 8192, - 400000 * 8192 }, + ((Uint64)400000) * ((Uint64)8192) }, { KEY_INTERNAL, @@ -2446,6 +2446,8 @@ void ConfigInfo::print(const Properties * section, } ndbout << endl; break; + case ConfigInfo::SECTION: + break; } } @@ -2495,13 +2497,15 @@ fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data){ ctx.reportError("Computer \"%s\" not declared" "- [%s] starting at line: %d", compId, ctx.fname, ctx.m_sectionLineno); + return false; } const char * hostname; if(!computer->get("HostName", &hostname)){ - ctx.reportError("HostName missing in [COMPUTER] Id: %s" - "- [%s] starting at line: %d", + ctx.reportError("HostName missing in [COMPUTER] (Id: %d) " + " - [%s] starting at line: %d", compId, ctx.fname, ctx.m_sectionLineno); + return false; } require(ctx.m_currentSection->put("HostName", hostname)); @@ -2643,6 +2647,8 @@ applyDefaultValues(InitConfigFileParser::Context & ctx, ctx.m_currentSection->put(name, val); break; } + case ConfigInfo::SECTION: + break; } } } diff --git a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp index d01b8189545..f4a8e1a8cd4 100644 --- a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp +++ b/ndb/src/common/mgmcommon/InitConfigFileParser.cpp @@ -305,7 +305,7 @@ InitConfigFileParser::storeNameValuePair(Context& ctx, } if (!m_info->verify(ctx.m_currentInfo, fname, value_int)) { ctx.reportError("Illegal value %s for parameter %s.\n" - "Legal values are between %d and %d", value, fname, + "Legal values are between %Lu and %Lu", value, fname, m_info->getMin(ctx.m_currentInfo, fname), m_info->getMax(ctx.m_currentInfo, fname)); return false; diff --git a/ndb/src/common/portlib/Makefile.am b/ndb/src/common/portlib/Makefile.am index 2b1c9eb5ac0..e6ecb30fe04 100644 --- a/ndb/src/common/portlib/Makefile.am +++ b/ndb/src/common/portlib/Makefile.am @@ -1 +1,18 @@ -SUBDIRS = unix +noinst_HEADERS = gcc.cpp + +noinst_LTLIBRARIES = libportlib.la + +libportlib_la_SOURCES = \ + NdbCondition.c NdbMutex.c NdbSleep.c NdbTick.c \ + NdbEnv.c NdbThread.c NdbHost.c NdbTCP.c \ + NdbDaemon.c NdbMem.c + +include $(top_srcdir)/ndb/config/common.mk.am +include $(top_srcdir)/ndb/config/type_util.mk.am + +EXTRA_PROGRAMS = memtest PortLibTest munmaptest + +PortLibTest_SOURCES = NdbPortLibTest.cpp +munmaptest_SOURCES = munmaptest.cpp + +# Don't update the files from bitkeeper diff --git a/ndb/src/common/portlib/unix/NdbCondition.c b/ndb/src/common/portlib/NdbCondition.c similarity index 100% rename from ndb/src/common/portlib/unix/NdbCondition.c rename to ndb/src/common/portlib/NdbCondition.c diff --git a/ndb/src/common/portlib/unix/NdbDaemon.c b/ndb/src/common/portlib/NdbDaemon.c similarity index 100% rename from ndb/src/common/portlib/unix/NdbDaemon.c rename to ndb/src/common/portlib/NdbDaemon.c diff --git a/ndb/src/common/portlib/unix/NdbEnv.c b/ndb/src/common/portlib/NdbEnv.c similarity index 100% rename from ndb/src/common/portlib/unix/NdbEnv.c rename to ndb/src/common/portlib/NdbEnv.c diff --git a/ndb/src/common/portlib/unix/NdbHost.c b/ndb/src/common/portlib/NdbHost.c similarity index 100% rename from ndb/src/common/portlib/unix/NdbHost.c rename to ndb/src/common/portlib/NdbHost.c diff --git a/ndb/src/common/portlib/unix/NdbMem.c b/ndb/src/common/portlib/NdbMem.c similarity index 100% rename from ndb/src/common/portlib/unix/NdbMem.c rename to ndb/src/common/portlib/NdbMem.c diff --git a/ndb/src/common/portlib/unix/NdbMutex.c b/ndb/src/common/portlib/NdbMutex.c similarity index 100% rename from ndb/src/common/portlib/unix/NdbMutex.c rename to ndb/src/common/portlib/NdbMutex.c diff --git a/ndb/src/common/portlib/test/NdbPortLibTest.cpp b/ndb/src/common/portlib/NdbPortLibTest.cpp similarity index 100% rename from ndb/src/common/portlib/test/NdbPortLibTest.cpp rename to ndb/src/common/portlib/NdbPortLibTest.cpp diff --git a/ndb/src/common/portlib/unix/NdbSleep.c b/ndb/src/common/portlib/NdbSleep.c similarity index 100% rename from ndb/src/common/portlib/unix/NdbSleep.c rename to ndb/src/common/portlib/NdbSleep.c diff --git a/ndb/src/common/portlib/unix/NdbTCP.c b/ndb/src/common/portlib/NdbTCP.c similarity index 100% rename from ndb/src/common/portlib/unix/NdbTCP.c rename to ndb/src/common/portlib/NdbTCP.c diff --git a/ndb/src/common/portlib/unix/NdbThread.c b/ndb/src/common/portlib/NdbThread.c similarity index 100% rename from ndb/src/common/portlib/unix/NdbThread.c rename to ndb/src/common/portlib/NdbThread.c diff --git a/ndb/src/common/portlib/unix/NdbTick.c b/ndb/src/common/portlib/NdbTick.c similarity index 100% rename from ndb/src/common/portlib/unix/NdbTick.c rename to ndb/src/common/portlib/NdbTick.c diff --git a/ndb/src/common/portlib/memtest/memtest.c b/ndb/src/common/portlib/memtest.c similarity index 100% rename from ndb/src/common/portlib/memtest/memtest.c rename to ndb/src/common/portlib/memtest.c diff --git a/ndb/src/common/portlib/mmstest/mmslist.cpp b/ndb/src/common/portlib/mmslist.cpp similarity index 100% rename from ndb/src/common/portlib/mmstest/mmslist.cpp rename to ndb/src/common/portlib/mmslist.cpp diff --git a/ndb/src/common/portlib/mmstest/mmstest.cpp b/ndb/src/common/portlib/mmstest.cpp similarity index 100% rename from ndb/src/common/portlib/mmstest/mmstest.cpp rename to ndb/src/common/portlib/mmstest.cpp diff --git a/ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp b/ndb/src/common/portlib/munmaptest.cpp similarity index 100% rename from ndb/src/common/portlib/memtest/munmaptest/munmaptest.cpp rename to ndb/src/common/portlib/munmaptest.cpp diff --git a/ndb/src/common/portlib/memtest/Makefile b/ndb/src/common/portlib/old_dirs/memtest/Makefile similarity index 100% rename from ndb/src/common/portlib/memtest/Makefile rename to ndb/src/common/portlib/old_dirs/memtest/Makefile diff --git a/ndb/src/common/portlib/memtest/munmaptest/Makefile b/ndb/src/common/portlib/old_dirs/memtest/munmaptest/Makefile similarity index 100% rename from ndb/src/common/portlib/memtest/munmaptest/Makefile rename to ndb/src/common/portlib/old_dirs/memtest/munmaptest/Makefile diff --git a/ndb/src/common/portlib/ose/Makefile b/ndb/src/common/portlib/old_dirs/ose/Makefile similarity index 100% rename from ndb/src/common/portlib/ose/Makefile rename to ndb/src/common/portlib/old_dirs/ose/Makefile diff --git a/ndb/src/common/portlib/ose/NdbCondition.c b/ndb/src/common/portlib/old_dirs/ose/NdbCondition.c similarity index 100% rename from ndb/src/common/portlib/ose/NdbCondition.c rename to ndb/src/common/portlib/old_dirs/ose/NdbCondition.c diff --git a/ndb/src/common/portlib/ose/NdbConditionOSE.h b/ndb/src/common/portlib/old_dirs/ose/NdbConditionOSE.h similarity index 100% rename from ndb/src/common/portlib/ose/NdbConditionOSE.h rename to ndb/src/common/portlib/old_dirs/ose/NdbConditionOSE.h diff --git a/ndb/src/common/portlib/ose/NdbEnv.c b/ndb/src/common/portlib/old_dirs/ose/NdbEnv.c similarity index 100% rename from ndb/src/common/portlib/ose/NdbEnv.c rename to ndb/src/common/portlib/old_dirs/ose/NdbEnv.c diff --git a/ndb/src/common/portlib/ose/NdbHost.c b/ndb/src/common/portlib/old_dirs/ose/NdbHost.c similarity index 100% rename from ndb/src/common/portlib/ose/NdbHost.c rename to ndb/src/common/portlib/old_dirs/ose/NdbHost.c diff --git a/ndb/src/common/portlib/ose/NdbMem.c b/ndb/src/common/portlib/old_dirs/ose/NdbMem.c similarity index 100% rename from ndb/src/common/portlib/ose/NdbMem.c rename to ndb/src/common/portlib/old_dirs/ose/NdbMem.c diff --git a/ndb/src/common/portlib/ose/NdbMem_SoftOse.cpp b/ndb/src/common/portlib/old_dirs/ose/NdbMem_SoftOse.cpp similarity index 100% rename from ndb/src/common/portlib/ose/NdbMem_SoftOse.cpp rename to ndb/src/common/portlib/old_dirs/ose/NdbMem_SoftOse.cpp diff --git a/ndb/src/common/portlib/ose/NdbMutex.c b/ndb/src/common/portlib/old_dirs/ose/NdbMutex.c similarity index 100% rename from ndb/src/common/portlib/ose/NdbMutex.c rename to ndb/src/common/portlib/old_dirs/ose/NdbMutex.c diff --git a/ndb/src/common/portlib/ose/NdbOut.cpp b/ndb/src/common/portlib/old_dirs/ose/NdbOut.cpp similarity index 100% rename from ndb/src/common/portlib/ose/NdbOut.cpp rename to ndb/src/common/portlib/old_dirs/ose/NdbOut.cpp diff --git a/ndb/src/common/portlib/ose/NdbSleep.c b/ndb/src/common/portlib/old_dirs/ose/NdbSleep.c similarity index 100% rename from ndb/src/common/portlib/ose/NdbSleep.c rename to ndb/src/common/portlib/old_dirs/ose/NdbSleep.c diff --git a/ndb/src/common/portlib/ose/NdbTCP.c b/ndb/src/common/portlib/old_dirs/ose/NdbTCP.c similarity index 100% rename from ndb/src/common/portlib/ose/NdbTCP.c rename to ndb/src/common/portlib/old_dirs/ose/NdbTCP.c diff --git a/ndb/src/common/portlib/ose/NdbThread.c b/ndb/src/common/portlib/old_dirs/ose/NdbThread.c similarity index 100% rename from ndb/src/common/portlib/ose/NdbThread.c rename to ndb/src/common/portlib/old_dirs/ose/NdbThread.c diff --git a/ndb/src/common/portlib/ose/NdbTick.c b/ndb/src/common/portlib/old_dirs/ose/NdbTick.c similarity index 100% rename from ndb/src/common/portlib/ose/NdbTick.c rename to ndb/src/common/portlib/old_dirs/ose/NdbTick.c diff --git a/ndb/src/common/portlib/test/Makefile b/ndb/src/common/portlib/old_dirs/test/Makefile similarity index 100% rename from ndb/src/common/portlib/test/Makefile rename to ndb/src/common/portlib/old_dirs/test/Makefile diff --git a/ndb/src/common/portlib/unix/Makefile_old b/ndb/src/common/portlib/old_dirs/unix/Makefile_old similarity index 100% rename from ndb/src/common/portlib/unix/Makefile_old rename to ndb/src/common/portlib/old_dirs/unix/Makefile_old diff --git a/ndb/src/common/portlib/win32/Makefile b/ndb/src/common/portlib/old_dirs/win32/Makefile similarity index 100% rename from ndb/src/common/portlib/win32/Makefile rename to ndb/src/common/portlib/old_dirs/win32/Makefile diff --git a/ndb/src/common/portlib/win32/NdbCondition.c b/ndb/src/common/portlib/old_dirs/win32/NdbCondition.c similarity index 100% rename from ndb/src/common/portlib/win32/NdbCondition.c rename to ndb/src/common/portlib/old_dirs/win32/NdbCondition.c diff --git a/ndb/src/common/portlib/win32/NdbDaemon.c b/ndb/src/common/portlib/old_dirs/win32/NdbDaemon.c similarity index 100% rename from ndb/src/common/portlib/win32/NdbDaemon.c rename to ndb/src/common/portlib/old_dirs/win32/NdbDaemon.c diff --git a/ndb/src/common/portlib/win32/NdbEnv.c b/ndb/src/common/portlib/old_dirs/win32/NdbEnv.c similarity index 100% rename from ndb/src/common/portlib/win32/NdbEnv.c rename to ndb/src/common/portlib/old_dirs/win32/NdbEnv.c diff --git a/ndb/src/common/portlib/win32/NdbHost.c b/ndb/src/common/portlib/old_dirs/win32/NdbHost.c similarity index 100% rename from ndb/src/common/portlib/win32/NdbHost.c rename to ndb/src/common/portlib/old_dirs/win32/NdbHost.c diff --git a/ndb/src/common/portlib/win32/NdbMem.c b/ndb/src/common/portlib/old_dirs/win32/NdbMem.c similarity index 100% rename from ndb/src/common/portlib/win32/NdbMem.c rename to ndb/src/common/portlib/old_dirs/win32/NdbMem.c diff --git a/ndb/src/common/portlib/win32/NdbMutex.c b/ndb/src/common/portlib/old_dirs/win32/NdbMutex.c similarity index 100% rename from ndb/src/common/portlib/win32/NdbMutex.c rename to ndb/src/common/portlib/old_dirs/win32/NdbMutex.c diff --git a/ndb/src/common/portlib/win32/NdbSleep.c b/ndb/src/common/portlib/old_dirs/win32/NdbSleep.c similarity index 100% rename from ndb/src/common/portlib/win32/NdbSleep.c rename to ndb/src/common/portlib/old_dirs/win32/NdbSleep.c diff --git a/ndb/src/common/portlib/win32/NdbTCP.c b/ndb/src/common/portlib/old_dirs/win32/NdbTCP.c similarity index 100% rename from ndb/src/common/portlib/win32/NdbTCP.c rename to ndb/src/common/portlib/old_dirs/win32/NdbTCP.c diff --git a/ndb/src/common/portlib/win32/NdbThread.c b/ndb/src/common/portlib/old_dirs/win32/NdbThread.c similarity index 100% rename from ndb/src/common/portlib/win32/NdbThread.c rename to ndb/src/common/portlib/old_dirs/win32/NdbThread.c diff --git a/ndb/src/common/portlib/win32/NdbTick.c b/ndb/src/common/portlib/old_dirs/win32/NdbTick.c similarity index 100% rename from ndb/src/common/portlib/win32/NdbTick.c rename to ndb/src/common/portlib/old_dirs/win32/NdbTick.c diff --git a/ndb/src/common/portlib/unix/Makefile.am b/ndb/src/common/portlib/unix/Makefile.am deleted file mode 100644 index f50d46c1873..00000000000 --- a/ndb/src/common/portlib/unix/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ - -noinst_LTLIBRARIES = libportlib.la - -libportlib_la_SOURCES = \ - NdbCondition.c NdbMutex.c NdbSleep.c NdbTick.c \ - NdbEnv.c NdbThread.c NdbHost.c NdbTCP.c \ - NdbDaemon.c NdbMem.c - -include $(top_srcdir)/ndb/config/common.mk.am -include $(top_srcdir)/ndb/config/type_util.mk.am - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/ndb/src/common/util/ConfigValues.cpp b/ndb/src/common/util/ConfigValues.cpp index 948b96135fd..18ecf4bcdc4 100644 --- a/ndb/src/common/util/ConfigValues.cpp +++ b/ndb/src/common/util/ConfigValues.cpp @@ -193,7 +193,7 @@ ConfigValues::Iterator::set(Uint32 key, const char * value){ char * & str = m_cfg.getString(m_cfg.m_values[pos+1]); free(str); - str = strdup(value); + str = strdup(value ? value : ""); return true; } @@ -457,7 +457,7 @@ ConfigValuesFactory::put(const ConfigValues::Entry & entry){ case ConfigValues::StringType:{ Uint32 index = m_cfg->m_stringCount++; m_cfg->m_values[pos+1] = index; - m_cfg->getString(index) = strdup(entry.m_string); + m_cfg->getString(index) = strdup(entry.m_string ? entry.m_string : ""); m_freeKeys--; m_freeData -= sizeof(char *); DEBUG printf("Putting at: %d(%d) (loop = %d) key: %d value(%d): %s\n", diff --git a/ndb/src/cw/cpcd/Makefile.am b/ndb/src/cw/cpcd/Makefile.am index 8d5a8d63e73..6345bae9bbe 100644 --- a/ndb/src/cw/cpcd/Makefile.am +++ b/ndb/src/cw/cpcd/Makefile.am @@ -3,10 +3,12 @@ ndbtools_PROGRAMS = ndb_cpcd ndb_cpcd_SOURCES = main.cpp CPCD.cpp Process.cpp APIService.cpp Monitor.cpp common.cpp -LDADD_LOC = $(top_srcdir)/ndb/src/.libs/libndbclient.a +LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_util.mk.am +ndb_cpcd_LDFLAGS = @ndb_bin_am_ldflags@ + # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/ndb/src/kernel/ndb-main/Main.cpp b/ndb/src/kernel/Main.cpp similarity index 98% rename from ndb/src/kernel/ndb-main/Main.cpp rename to ndb/src/kernel/Main.cpp index 961d111f298..7bd4e75ca18 100644 --- a/ndb/src/kernel/ndb-main/Main.cpp +++ b/ndb/src/kernel/Main.cpp @@ -91,6 +91,7 @@ NDB_MAIN(ndb_kernel){ * Parent */ catchsigs(true); + int status = 0; while(waitpid(child, &status, 0) != child); if(WIFEXITED(status)){ @@ -112,6 +113,13 @@ NDB_MAIN(ndb_kernel){ globalData.theRestartFlag = perform_start; break; default: + if(theConfig->stopOnError()){ + /** + * Error shutdown && stopOnError() + */ + exit(0); + } + // Fall-through case NRT_DoStart_Restart: theConfig->setInitialStart(false); globalData.theRestartFlag = perform_start; diff --git a/ndb/src/kernel/Makefile.am b/ndb/src/kernel/Makefile.am index 1e52a561964..b2aa5f2e074 100644 --- a/ndb/src/kernel/Makefile.am +++ b/ndb/src/kernel/Makefile.am @@ -1 +1,58 @@ -SUBDIRS = error blocks vm ndb-main +SUBDIRS = error blocks vm + +include $(top_srcdir)/ndb/config/common.mk.am + +ndbbin_PROGRAMS = ndbd + +ndbd_SOURCES = Main.cpp SimBlockList.cpp + +include $(top_srcdir)/ndb/config/type_kernel.mk.am + +INCLUDES += \ + -Iblocks/cmvmi \ + -Iblocks/dbacc \ + -Iblocks/dbdict \ + -Iblocks/dbdih \ + -Iblocks/dblqh \ + -Iblocks/dbtc \ + -Iblocks/dbtup \ + -Iblocks/ndbfs \ + -Iblocks/ndbcntr \ + -Iblocks/qmgr \ + -Iblocks/trix \ + -Iblocks/backup \ + -Iblocks/dbutil \ + -Iblocks/suma \ + -Iblocks/grep \ + -Iblocks/dbtux + +LDADD += \ + blocks/cmvmi/libcmvmi.a \ + blocks/dbacc/libdbacc.a \ + blocks/dbdict/libdbdict.a \ + blocks/dbdih/libdbdih.a \ + blocks/dblqh/libdblqh.a \ + blocks/dbtc/libdbtc.a \ + blocks/dbtup/libdbtup.a \ + blocks/ndbfs/libndbfs.a \ + blocks/ndbcntr/libndbcntr.a \ + blocks/qmgr/libqmgr.a \ + blocks/trix/libtrix.a \ + blocks/backup/libbackup.a \ + blocks/dbutil/libdbutil.a \ + blocks/suma/libsuma.a \ + blocks/grep/libgrep.a \ + blocks/dbtux/libdbtux.a \ + vm/libkernel.a \ + error/liberror.a \ + $(top_builddir)/ndb/src/common/transporter/libtransporter.la \ + $(top_builddir)/ndb/src/common/debugger/libtrace.la \ + $(top_builddir)/ndb/src/common/debugger/signaldata/libsignaldataprint.la \ + $(top_builddir)/ndb/src/common/logger/liblogger.la \ + $(top_builddir)/ndb/src/common/mgmcommon/libmgmsrvcommon.la \ + $(top_builddir)/ndb/src/mgmapi/libmgmapi.la \ + $(top_builddir)/ndb/src/common/portlib/libportlib.la \ + $(top_builddir)/ndb/src/common/util/libgeneral.la + +# Don't update the files from bitkeeper +%::SCCS/s.% diff --git a/ndb/src/kernel/ndb-main/SimBlockList.cpp b/ndb/src/kernel/SimBlockList.cpp similarity index 100% rename from ndb/src/kernel/ndb-main/SimBlockList.cpp rename to ndb/src/kernel/SimBlockList.cpp diff --git a/ndb/src/kernel/blocks/backup/restore/Makefile.am b/ndb/src/kernel/blocks/backup/restore/Makefile.am index cf90587eda8..e0429c60723 100644 --- a/ndb/src/kernel/blocks/backup/restore/Makefile.am +++ b/ndb/src/kernel/blocks/backup/restore/Makefile.am @@ -1,10 +1,12 @@ -ndbtools_PROGRAMS = restore +ndbtools_PROGRAMS = ndb_restore -restore_SOURCES = main.cpp Restore.cpp +ndb_restore_SOURCES = main.cpp consumer.cpp consumer_restore.cpp consumer_printer.cpp Restore.cpp -LDADD_LOC = $(top_srcdir)/ndb/src/libndbclient.la +LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la include $(top_srcdir)/ndb/config/common.mk.am INCLUDES += -I.. -I$(top_srcdir)/include -I$(top_srcdir)/ndb/include -I$(top_srcdir)/ndb/src/ndbapi -I$(top_srcdir)/ndb/include/ndbapi -I$(top_srcdir)/ndb/include/util -I$(top_srcdir)/ndb/include/portlib -I$(top_srcdir)/ndb/include/kernel + +ndb_restore_LDFLAGS = @ndb_bin_am_ldflags@ diff --git a/ndb/src/kernel/blocks/backup/restore/Makefile_old b/ndb/src/kernel/blocks/backup/restore/Makefile_old deleted file mode 100644 index 4c884525d73..00000000000 --- a/ndb/src/kernel/blocks/backup/restore/Makefile_old +++ /dev/null @@ -1,20 +0,0 @@ -include .defs.mk - -TYPE := * - -BIN_TARGET := restore -BIN_TARGET_LIBS := -BIN_TARGET_ARCHIVES := NDB_API - -CCFLAGS_LOC = -I.. -I$(NDB_TOP)/src/ndbapi -I$(NDB_TOP)/include/ndbapi -I$(NDB_TOP)/include/util -I$(NDB_TOP)/include/portlib -I$(NDB_TOP)/include/kernel - -#ifneq ($(MYSQLCLUSTER_TOP),) -#CCFLAGS_LOC +=-I$(MYSQLCLUSTER_TOP)/include -D USE_MYSQL -#LDFLAGS_LOC += -L$(MYSQLCLUSTER_TOP)/libmysql_r/ -lmysqlclient_r -#endif - -SOURCES = main.cpp Restore.cpp - -include $(NDB_TOP)/Epilogue.mk - - diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.cpp b/ndb/src/kernel/blocks/backup/restore/Restore.cpp index 04f82ce91d0..24d2cfbfe35 100644 --- a/ndb/src/kernel/blocks/backup/restore/Restore.cpp +++ b/ndb/src/kernel/blocks/backup/restore/Restore.cpp @@ -33,32 +33,32 @@ Uint32 Twiddle32(Uint32 in); // Byte shift 32-bit data Uint64 Twiddle64(Uint64 in); // Byte shift 64-bit data bool -BackupFile::Twiddle(AttributeS* attr, Uint32 arraySize){ +BackupFile::Twiddle(const AttributeDesc* attr_desc, AttributeData* attr_data, Uint32 arraySize){ if(m_hostByteOrder) return true; if(arraySize == 0){ - arraySize = attr->Desc->arraySize; + arraySize = attr_desc->arraySize; } - switch(attr->Desc->size){ + switch(attr_desc->size){ case 8: return true; case 16: for(unsigned i = 0; iData.u_int16_value[i] = Twiddle16(attr->Data.u_int16_value[i]); + attr_data->u_int16_value[i] = Twiddle16(attr_data->u_int16_value[i]); } return true; case 32: for(unsigned i = 0; iData.u_int32_value[i] = Twiddle32(attr->Data.u_int32_value[i]); + attr_data->u_int32_value[i] = Twiddle32(attr_data->u_int32_value[i]); } return true; case 64: for(unsigned i = 0; iData.u_int64_value[i] = Twiddle64(attr->Data.u_int64_value[i]); + attr_data->u_int64_value[i] = Twiddle64(attr_data->u_int64_value[i]); } return true; default: @@ -82,14 +82,14 @@ RestoreMetaData::RestoreMetaData(const char* path, Uint32 nodeId, Uint32 bNo) { } RestoreMetaData::~RestoreMetaData(){ - for(int i = 0; igetTableId() == tableId) return allTables[i]; return NULL; @@ -104,8 +104,9 @@ int RestoreMetaData::loadContent() { Uint32 noOfTables = readMetaTableList(); - if(noOfTables == 0) - return -3; + if(noOfTables == 0) { + return 1; + } for(Uint32 i = 0; igetNoOfColumns(); i++) + createAttr(tableImpl->getColumn(i)); +} -static const -SimpleProperties::SP2StructMapping -RestoreTabMap[] = { - // Map the basic stuff to begin with - DTIMAP(tmpTableS, TableId, tableId), - DTIMAP(tmpTableS, TableVersion, schemaVersion), - DTIMAP(tmpTableS, NoOfAttributes, noOfAttributes), - - DTIBREAK(AttributeName) -}; // RestoreTabMap - -static const Uint32 -TabMapSize = sizeof(RestoreTabMap) - / sizeof(SimpleProperties::SP2StructMapping); - -/** - * Use a temporary struct to keep variables in AttributeDesc private - * and DTIMAP requires all Uint32 - */ -struct tmpAttrS { - // Just the basic needed stuff is yet implemented - char name[AttrNameLenC]; - Uint32 attrId; - Uint32 type; - Uint32 nullable; - Uint32 key; - Uint32 size; - Uint32 arraySize; -}; - -static const -SimpleProperties::SP2StructMapping -RestoreAttrMap[] = { - // Map the most basic properties - DTIMAP(tmpAttrS, AttributeId, attrId), - DTIMAP(tmpAttrS, AttributeType, type), - DTIMAP(tmpAttrS, AttributeNullableFlag, nullable), - DTIMAP(tmpAttrS, AttributeKeyFlag, key), - DTIMAP(tmpAttrS, AttributeSize, size), - DTIMAP(tmpAttrS, AttributeArraySize, arraySize), - DTIBREAK(AttributeEnd) -}; // RestoreAttrMap -static const Uint32 -AttrMapSize = sizeof(RestoreAttrMap) - / sizeof(SimpleProperties::SP2StructMapping); +TableS::~TableS() +{ + for (Uint32 i= 0; i < allAttributesDesc.size(); i++) + delete allAttributesDesc[i]; +} // Parse dictTabInfo buffer and pushback to to vector storage -// Using SimpleProperties (here we don't need ntohl, ref:ejonore) bool RestoreMetaData::parseTableDescriptor(const Uint32 * data, Uint32 len) { - SimplePropertiesLinearReader it(data, len); - SimpleProperties::UnpackStatus spStatus; - - // Parse table name - if (it.getKey() != DictTabInfo::TableName) { - err << "readMetaTableDesc getKey table name error" << endl; - return false; - } // if - - char tableName[MAX_TAB_NAME_SIZE*2]; // * 2 for db and schema.-. - it.getString(tableName); - - if (strlen(tableName) == 0) { - err << "readMetaTableDesc getString table name error" << endl; - return false; - } // if - - TableS * table = new TableS(tableName); - if(table == NULL) { - return false; - } - - table->setBackupVersion(m_fileHeader.NdbVersion); - tmpTableS tmpTable; - spStatus = SimpleProperties::unpack(it, &tmpTable, - RestoreTabMap, TabMapSize, true, true); - if ((spStatus != SimpleProperties::Break) || - it.getKey() != DictTabInfo::AttributeName) { - err << "readMetaTableDesc sp.unpack error" << endl; - delete table; - return false; - } // if - - debug << "Parsed table id " << tmpTable.tableId << endl; - table->setTableId(tmpTable.tableId); - debug << "Parsed table #attr " << tmpTable.noOfAttributes << endl; - debug << "Parsed table schema version not used " << endl; - - for (Uint32 i = 0; i < tmpTable.noOfAttributes; i++) { - if (it.getKey() != DictTabInfo::AttributeName) { - err << "readMetaTableDesc error " << endl; - delete table; - return false; - } // if - - tmpAttrS tmpAttr; - if(it.getValueLen() > AttrNameLenC){ - err << "readMetaTableDesc attribute name too long??" << endl; - delete table; - return false; - } - it.getString(tmpAttr.name); - - spStatus = SimpleProperties::unpack(it, &tmpAttr, RestoreAttrMap, - AttrMapSize, true, true); - if ((spStatus != SimpleProperties::Break) || - (it.getKey() != DictTabInfo::AttributeEnd)) { - err << "readMetaTableDesc sp unpack attribute " << i << " error" - << endl; - delete table; - return false; - } // if - - debug << "Creating attribute " << i << " " << tmpAttr.name << endl; - - bool thisNullable = (bool)(tmpAttr.nullable); // Really not needed (now) - KeyType thisKey = (KeyType)(tmpAttr.key); // These are identical (right now) - // Convert attribute size from enum to Uint32 - // The static consts are really enum taking the value in DictTabInfo - // e.g. 3 is not ...0011 but rather ...0100 - //TODO: rather do a switch if the constants should change - Uint32 thisSize = 1 << tmpAttr.size; - // Convert attribute type to AttrType - AttrType thisType; - switch (tmpAttr.type) { - case 0: // SignedType - thisType = Signed; - break; - case 1: // UnSignedType - thisType = UnSigned; - break; - case 2: // FloatingPointType - thisType = Float; - break; - case 3: // StringType: - debug << "String type detected " << endl; - thisType = String; - break; - default: - // What, default to unsigned? - thisType = UnSigned; - break; - } // switch - /* ndbout_c << " type: " << thisType << " size: " << thisSize <<" arraySize: " - << tmpAttr.arraySize << " nullable: " << thisNullable << " key: " - << thisKey << endl; - */ - table->createAttr(tmpAttr.name, thisType, - thisSize, tmpAttr.arraySize, - thisNullable, thisKey); - if (!it.next()) { - break; - // Check number of created attributes and compare with expected - //ndbout << "readMetaTableDesc expecting more attributes" << endl; - //return false; - } // if - } // for - - debug << "Pushing table " << tableName << endl; - debug << " with " << table->getNoOfAttributes() << " attributes" << endl; - allTables.push_back(table); - NdbTableImpl* tableImpl = 0; int ret = NdbDictInterface::parseTableInfo(&tableImpl, data, len, false); if (ret != 0) { - err << "parseTableInfo " << tableName << " failed" << endl; + err << "parseTableInfo " << " failed" << endl; return false; } if(tableImpl == 0) return false; - debug << "parseTableInfo " << tableName << " done" << endl; - table->m_dictTable = tableImpl; + + debug << "parseTableInfo " << tableImpl->getName() << " done" << endl; + + TableS * table = new TableS(tableImpl); + if(table == NULL) { + return false; + } + table->setBackupVersion(m_fileHeader.NdbVersion); + + debug << "Parsed table id " << table->getTableId() << endl; + debug << "Parsed table #attr " << table->getNoOfAttributes() << endl; + debug << "Parsed table schema version not used " << endl; + + debug << "Pushing table " << table->getTableName() << endl; + debug << " with " << table->getNoOfAttributes() << " attributes" << endl; + allTables.push_back(table); return true; } // Constructor -RestoreDataIterator::RestoreDataIterator(const RestoreMetaData & md) - : m_metaData(md) +RestoreDataIterator::RestoreDataIterator(const RestoreMetaData & md, void (* _free_data_callback)()) + : BackupFile(_free_data_callback), m_metaData(md) { debug << "RestoreDataIterator constructor" << endl; setDataFile(md, 0); } -RestoreDataIterator::~RestoreDataIterator(){ +TupleS & TupleS::operator=(const TupleS& tuple) +{ + prepareRecord(*tuple.m_currentTable); + + if (allAttrData) + memcpy(allAttrData, tuple.allAttrData, getNoOfAttributes()*sizeof(AttributeData)); + + return *this; +}; +int TupleS::getNoOfAttributes() const { + if (m_currentTable == 0) + return 0; + return m_currentTable->getNoOfAttributes(); +}; + +const TableS * TupleS::getTable() const { + return m_currentTable; +}; + +const AttributeDesc * TupleS::getDesc(int i) const { + return m_currentTable->allAttributesDesc[i]; } +AttributeData * TupleS::getData(int i) const{ + return &(allAttrData[i]); +}; + bool TupleS::prepareRecord(const TableS & tab){ - m_currentTable = &tab; - for(int i = 0; iDesc = tab[i]; - allAttributes.push_back(a); + delete [] allAttrData; + m_currentTable= 0; } + + allAttrData = new AttributeData[tab.getNoOfAttributes()]; + if (allAttrData == 0) + return false; + + m_currentTable = &tab; + return true; } const TupleS * -RestoreDataIterator::getNextTuple(int & res) { - TupleS * tup = new TupleS(); - if(tup == NULL) { - ndbout_c("Restore: Failed to allocate memory"); - res = -1; - return NULL; - } - if(!tup->prepareRecord(* m_currentTable)) { - res =-1; - return NULL; - } - - +RestoreDataIterator::getNextTuple(int & res) +{ Uint32 dataLength = 0; // Read record length - if (fread(&dataLength, sizeof(dataLength), 1, m_file) != 1){ + if (buffer_read(&dataLength, sizeof(dataLength), 1) != 1){ err << "getNextTuple:Error reading length of data part" << endl; - delete tup; res = -1; return NULL; } // if @@ -450,34 +320,34 @@ RestoreDataIterator::getNextTuple(int & res) { // End of this data fragment debug << "End of fragment" << endl; res = 0; - delete tup; return NULL; } // if - - tup->createDataRecord(dataLenBytes); + // Read tuple data - if (fread(tup->getDataRecord(), 1, dataLenBytes, m_file) != dataLenBytes) { + void *_buf_ptr; + if (buffer_get_ptr(&_buf_ptr, 1, dataLenBytes) != dataLenBytes) { err << "getNextTuple:Read error: " << endl; - delete tup; res = -1; return NULL; } - Uint32 * ptr = tup->getDataRecord(); + Uint32 *buf_ptr = (Uint32*)_buf_ptr, *ptr = buf_ptr; ptr += m_currentTable->m_nullBitmaskSize; - for(int i = 0; i < m_currentTable->m_fixedKeys.size(); i++){ - assert(ptr < tup->getDataRecord() + dataLength); - + for(Uint32 i= 0; i < m_currentTable->m_fixedKeys.size(); i++){ + assert(ptr < buf_ptr + dataLength); + const Uint32 attrId = m_currentTable->m_fixedKeys[i]->attrId; - AttributeS * attr = tup->allAttributes[attrId]; - const Uint32 sz = attr->Desc->getSizeInWords(); + AttributeData * attr_data = m_tuple.getData(attrId); + const AttributeDesc * attr_desc = m_tuple.getDesc(attrId); - attr->Data.null = false; - attr->Data.void_value = ptr; + const Uint32 sz = attr_desc->getSizeInWords(); - if(!Twiddle(attr)) + attr_data->null = false; + attr_data->void_value = ptr; + + if(!Twiddle(attr_desc, attr_data)) { res = -1; return NULL; @@ -485,18 +355,20 @@ RestoreDataIterator::getNextTuple(int & res) { ptr += sz; } - for(int i = 0; im_fixedAttribs.size(); i++){ - assert(ptr < tup->getDataRecord() + dataLength); + for(Uint32 i = 0; i < m_currentTable->m_fixedAttribs.size(); i++){ + assert(ptr < buf_ptr + dataLength); const Uint32 attrId = m_currentTable->m_fixedAttribs[i]->attrId; - AttributeS * attr = tup->allAttributes[attrId]; - const Uint32 sz = attr->Desc->getSizeInWords(); + AttributeData * attr_data = m_tuple.getData(attrId); + const AttributeDesc * attr_desc = m_tuple.getDesc(attrId); - attr->Data.null = false; - attr->Data.void_value = ptr; + const Uint32 sz = attr_desc->getSizeInWords(); - if(!Twiddle(attr)) + attr_data->null = false; + attr_data->void_value = ptr; + + if(!Twiddle(attr_desc, attr_data)) { res = -1; return NULL; @@ -505,21 +377,23 @@ RestoreDataIterator::getNextTuple(int & res) { ptr += sz; } - for(int i = 0; im_variableAttribs.size(); i++){ + for(Uint32 i = 0; i < m_currentTable->m_variableAttribs.size(); i++){ const Uint32 attrId = m_currentTable->m_variableAttribs[i]->attrId; - AttributeS * attr = tup->allAttributes[attrId]; + + AttributeData * attr_data = m_tuple.getData(attrId); + const AttributeDesc * attr_desc = m_tuple.getDesc(attrId); - if(attr->Desc->nullable){ - const Uint32 ind = attr->Desc->m_nullBitIndex; + if(attr_desc->m_column->getNullable()){ + const Uint32 ind = attr_desc->m_nullBitIndex; if(BitmaskImpl::get(m_currentTable->m_nullBitmaskSize, - tup->getDataRecord(),ind)){ - attr->Data.null = true; - attr->Data.void_value = NULL; + buf_ptr,ind)){ + attr_data->null = true; + attr_data->void_value = NULL; continue; } } - assert(ptr < tup->getDataRecord() + dataLength); + assert(ptr < buf_ptr + dataLength); typedef BackupFormat::DataFile::VariableData VarData; VarData * data = (VarData *)ptr; @@ -527,15 +401,15 @@ RestoreDataIterator::getNextTuple(int & res) { Uint32 id = ntohl(data->Id); assert(id == attrId); - attr->Data.null = false; - attr->Data.void_value = &data->Data[0]; + attr_data->null = false; + attr_data->void_value = &data->Data[0]; /** * Compute array size */ - const Uint32 arraySize = (4 * sz) / (attr->Desc->size / 8); - assert(arraySize >= attr->Desc->arraySize); - if(!Twiddle(attr, attr->Desc->arraySize)) + const Uint32 arraySize = (4 * sz) / (attr_desc->size / 8); + assert(arraySize >= attr_desc->arraySize); + if(!Twiddle(attr_desc, attr_data, attr_desc->arraySize)) { res = -1; return NULL; @@ -546,15 +420,20 @@ RestoreDataIterator::getNextTuple(int & res) { m_count ++; res = 0; - return tup; + return &m_tuple; } // RestoreDataIterator::getNextTuple -BackupFile::BackupFile(){ +BackupFile::BackupFile(void (* _free_data_callback)()) + : free_data_callback(_free_data_callback) +{ m_file = 0; m_path[0] = 0; m_fileName[0] = 0; - m_buffer = 0; - m_bufferSize = 0; + + m_buffer_sz = 64*1024; + m_buffer = malloc(m_buffer_sz); + m_buffer_ptr = m_buffer; + m_buffer_data_left = 0; } BackupFile::~BackupFile(){ @@ -575,15 +454,54 @@ BackupFile::openFile(){ return m_file != 0; } -Uint32 * -BackupFile::createBuffer(Uint32 bytes){ - if(bytes > m_bufferSize){ - if(m_buffer != 0) - free(m_buffer); - m_bufferSize = m_bufferSize + 2 * bytes; - m_buffer = (Uint32*)malloc(m_bufferSize); +Uint32 BackupFile::buffer_get_ptr_ahead(void **p_buf_ptr, Uint32 size, Uint32 nmemb) +{ + Uint32 sz = size*nmemb; + if (sz > m_buffer_data_left) { + + if (free_data_callback) + (*free_data_callback)(); + + memcpy(m_buffer, m_buffer_ptr, m_buffer_data_left); + + size_t r = fread(((char *)m_buffer) + m_buffer_data_left, 1, m_buffer_sz - m_buffer_data_left, m_file); + m_buffer_data_left += r; + m_buffer_ptr = m_buffer; + + if (sz > m_buffer_data_left) + sz = size * (m_buffer_data_left / size); } - return m_buffer; + + *p_buf_ptr = m_buffer_ptr; + + return sz/size; +} +Uint32 BackupFile::buffer_get_ptr(void **p_buf_ptr, Uint32 size, Uint32 nmemb) +{ + Uint32 r = buffer_get_ptr_ahead(p_buf_ptr, size, nmemb); + + m_buffer_ptr = ((char*)m_buffer_ptr)+(r*size); + m_buffer_data_left -= (r*size); + + return r; +} + +Uint32 BackupFile::buffer_read_ahead(void *ptr, Uint32 size, Uint32 nmemb) +{ + void *buf_ptr; + Uint32 r = buffer_get_ptr_ahead(&buf_ptr, size, nmemb); + memcpy(ptr, buf_ptr, r*size); + + return r; +} + +Uint32 BackupFile::buffer_read(void *ptr, Uint32 size, Uint32 nmemb) +{ + void *buf_ptr; + Uint32 r = buffer_get_ptr(&buf_ptr, size, nmemb); + memcpy(ptr, buf_ptr, r*size); + + return r; } void @@ -644,7 +562,7 @@ BackupFile::readHeader(){ return false; } - if(fread(&m_fileHeader, sizeof(m_fileHeader), 1, m_file) != 1){ + if(buffer_read(&m_fileHeader, sizeof(m_fileHeader), 1) != 1){ err << "readDataFileHeader: Error reading header" << endl; return false; } @@ -692,14 +610,13 @@ BackupFile::validateFooter(){ return true; } -bool -RestoreDataIterator::readFragmentHeader(int & ret) +bool RestoreDataIterator::readFragmentHeader(int & ret) { BackupFormat::DataFile::FragmentHeader Header; debug << "RestoreDataIterator::getNextFragment" << endl; - if (fread(&Header, sizeof(Header), 1, m_file) != 1){ + if (buffer_read(&Header, sizeof(Header), 1) != 1){ ret = 0; return false; } // if @@ -722,6 +639,12 @@ RestoreDataIterator::readFragmentHeader(int & ret) return false; } + if(!m_tuple.prepareRecord(*m_currentTable)) + { + ret =-1; + return false; + } + info << "_____________________________________________________" << endl << "Restoring data in table: " << m_currentTable->getTableName() << "(" << Header.TableId << ") fragment " @@ -729,6 +652,7 @@ RestoreDataIterator::readFragmentHeader(int & ret) m_count = 0; ret = 0; + return true; } // RestoreDataIterator::getNextFragment @@ -737,7 +661,7 @@ bool RestoreDataIterator::validateFragmentFooter() { BackupFormat::DataFile::FragmentFooter footer; - if (fread(&footer, sizeof(footer), 1, m_file) != 1){ + if (buffer_read(&footer, sizeof(footer), 1) != 1){ err << "getFragmentFooter:Error reading fragment footer" << endl; return false; } @@ -755,44 +679,39 @@ RestoreDataIterator::validateFragmentFooter() { return true; } // RestoreDataIterator::getFragmentFooter -void TableS::createAttr(const char* name, - const AttrType type, - const unsigned int size, // in bytes - const unsigned int arraySize, - const bool nullable, - const KeyType key) +AttributeDesc::AttributeDesc(NdbDictionary::Column *c) + : m_column(c) { - AttributeDesc desc; + size = c->getSize()*8; + arraySize = c->getLength(); +} - strncpy(desc.name, name, AttrNameLenC); - desc.type = type; - desc.size = size; - desc.arraySize = arraySize; - desc.nullable = nullable; - desc.key = key; - desc.attrId = allAttributesDesc.size(); - - AttributeDesc * d = new AttributeDesc(desc); +void TableS::createAttr(NdbDictionary::Column *column) +{ + AttributeDesc * d = new AttributeDesc(column); if(d == NULL) { ndbout_c("Restore: Failed to allocate memory"); abort(); } - d->m_table = this; + d->attrId = allAttributesDesc.size(); allAttributesDesc.push_back(d); - if(desc.key != NoKey /* && not variable */){ + if(d->m_column->getPrimaryKey() /* && not variable */) + { m_fixedKeys.push_back(d); return; } - if(!nullable){ + + if(!d->m_column->getNullable()) + { m_fixedAttribs.push_back(d); return; } - if(nullable){ - d->m_nullBitIndex = m_noOfNullable; - m_noOfNullable++; - m_nullBitmaskSize = (m_noOfNullable + 31) / 32; - } + + /* Nullable attr*/ + d->m_nullBitIndex = m_noOfNullable; + m_noOfNullable++; + m_nullBitmaskSize = (m_noOfNullable + 31) / 32; m_variableAttribs.push_back(d); } // TableS::createAttr @@ -850,45 +769,32 @@ RestoreLogIterator::getNextLogEntry(int & res) { // Read record length typedef BackupFormat::LogFile::LogEntry LogE; - Uint32 gcp = 0; - LogE * logE = 0; - Uint32 len = ~0; + Uint32 gcp= 0; + LogE * logE= 0; + Uint32 len= ~0; const Uint32 stopGCP = m_metaData.getStopGCP(); do { - - if(createBuffer(4) == 0) { - res = -1; - return NULL; + if (buffer_read_ahead(&len, sizeof(Uint32), 1) != 1){ + res= -1; + return 0; } - + len= ntohl(len); - if (fread(m_buffer, sizeof(Uint32), 1, m_file) != 1){ - res = -1; - return NULL; + Uint32 data_len = sizeof(Uint32) + len*4; + if (buffer_get_ptr((void **)(&logE), 1, data_len) != data_len) { + res= -2; + return 0; } - m_buffer[0] = ntohl(m_buffer[0]); - len = m_buffer[0]; if(len == 0){ - res = 0; + res= 0; return 0; } - if(createBuffer(4 * (len + 1)) == 0){ - res = -1; - return NULL; - } + logE->TableId= ntohl(logE->TableId); + logE->TriggerEvent= ntohl(logE->TriggerEvent); - if (fread(&m_buffer[1], 4, len, m_file) != len) { - res = -1; - return NULL; - } - - logE = (LogE *)&m_buffer[0]; - logE->TableId = ntohl(logE->TableId); - logE->TriggerEvent = ntohl(logE->TriggerEvent); - - const bool hasGcp = (logE->TriggerEvent & 0x10000) != 0; + const bool hasGcp= (logE->TriggerEvent & 0x10000) != 0; logE->TriggerEvent &= 0xFFFF; if(hasGcp){ @@ -897,9 +803,6 @@ RestoreLogIterator::getNextLogEntry(int & res) { } } while(gcp > stopGCP + 1); - for(int i=0; iTableId); switch(logE->TriggerEvent){ case TriggerEvent::TE_INSERT: @@ -917,17 +820,19 @@ RestoreLogIterator::getNextLogEntry(int & res) { } const TableS * tab = m_logEntry.m_table; + m_logEntry.clear(); AttributeHeader * ah = (AttributeHeader *)&logE->Data[0]; AttributeHeader *end = (AttributeHeader *)&logE->Data[len - 2]; AttributeS * attr; while(ah < end){ - attr = new AttributeS; + attr= m_logEntry.add_attr(); if(attr == NULL) { ndbout_c("Restore: Failed to allocate memory"); res = -1; - return NULL; + return 0; } + attr->Desc = (* tab)[ah->getAttributeId()]; assert(attr->Desc != 0); @@ -940,13 +845,94 @@ RestoreLogIterator::getNextLogEntry(int & res) { attr->Data.void_value = ah->getDataPtr(); } - Twiddle(attr); - m_logEntry.m_values.push_back(attr); + Twiddle(attr->Desc, &(attr->Data)); ah = ah->getNext(); } - + m_count ++; res = 0; return &m_logEntry; } + +NdbOut & +operator<<(NdbOut& ndbout, const AttributeS& attr){ + const AttributeData & data = attr.Data; + const AttributeDesc & desc = *(attr.Desc); + + if (data.null) + { + ndbout << ""; + return ndbout; + } + + NdbRecAttr tmprec; + tmprec.setup(desc.m_column, (char *)data.void_value); + ndbout << tmprec; + + return ndbout; +} + +// Print tuple data +NdbOut& +operator<<(NdbOut& ndbout, const TupleS& tuple) +{ + ndbout << tuple.getTable()->getTableName() << "; "; + for (int i = 0; i < tuple.getNoOfAttributes(); i++) + { + AttributeData * attr_data = tuple.getData(i); + const AttributeDesc * attr_desc = tuple.getDesc(i); + const AttributeS attr = {attr_desc, *attr_data}; + debug << i << " " << attr_desc->m_column->getName(); + ndbout << attr; + + if (i != (tuple.getNoOfAttributes() - 1)) + ndbout << delimiter << " "; + } // for + return ndbout; +} + +// Print tuple data +NdbOut& +operator<<(NdbOut& ndbout, const LogEntry& logE) +{ + switch(logE.m_type) + { + case LogEntry::LE_INSERT: + ndbout << "INSERT " << logE.m_table->getTableName() << " "; + break; + case LogEntry::LE_DELETE: + ndbout << "DELETE " << logE.m_table->getTableName() << " "; + break; + case LogEntry::LE_UPDATE: + ndbout << "UPDATE " << logE.m_table->getTableName() << " "; + break; + default: + ndbout << "Unknown log entry type (not insert, delete or update)" ; + } + + for (Uint32 i= 0; i < logE.size();i++) + { + const AttributeS * attr = logE[i]; + ndbout << attr->Desc->m_column->getName() << "="; + ndbout << (* attr); + if (i < (logE.size() - 1)) + ndbout << ", "; + } + return ndbout; +} + + +NdbOut & +operator<<(NdbOut& ndbout, const TableS & table){ + ndbout << endl << "Table: " << table.getTableName() << endl; + for (int j = 0; j < table.getNoOfAttributes(); j++) + { + const AttributeDesc * desc = table[j]; + ndbout << desc->m_column->getName() << ": " << desc->m_column->getType(); + ndbout << " key: " << desc->m_column->getPrimaryKey(); + ndbout << " array: " << desc->arraySize; + ndbout << " size: " << desc->size << endl; + } // for + return ndbout; +} diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.hpp b/ndb/src/kernel/blocks/backup/restore/Restore.hpp index c01fbf67593..e9149e38e44 100644 --- a/ndb/src/kernel/blocks/backup/restore/Restore.hpp +++ b/ndb/src/kernel/blocks/backup/restore/Restore.hpp @@ -18,14 +18,15 @@ #define RESTORE_H #include +#include #include #include -#include -#include "myVector.hpp" #include #include +static const char * delimiter = ";"; // Delimiter in file dump + const int FileNameLenC = 256; const int TableNameLenC = 256; const int AttrNameLenC = 256; @@ -62,29 +63,22 @@ struct AttributeData { struct AttributeDesc { //private: - // TODO (sometimes): use a temporary variable in DTIMAP so we can - // hide AttributeDesc private variables friend class TupleS; friend class TableS; friend class RestoreDataIterator; friend class RestoreMetaData; friend struct AttributeS; - char name[AttrNameLenC]; - Uint32 attrId; - AttrType type; - bool nullable; - KeyType key; Uint32 size; // bits Uint32 arraySize; + Uint32 attrId; + NdbDictionary::Column *m_column; Uint32 m_nullBitIndex; public: - AttributeDesc() { - name[0] = 0; - } + AttributeDesc(NdbDictionary::Column *column); + AttributeDesc(); - const TableS * m_table; Uint32 getSizeInWords() const { return (size * arraySize + 31)/ 32;} }; // AttributeDesc @@ -97,19 +91,26 @@ class TupleS { private: friend class RestoreDataIterator; - const TableS * m_currentTable; - myVector allAttributes; - Uint32 * dataRecord; + const TableS *m_currentTable; + AttributeData *allAttrData; bool prepareRecord(const TableS &); public: - TupleS() {dataRecord = NULL;}; - ~TupleS() {if(dataRecord != NULL) delete [] dataRecord;}; - int getNoOfAttributes() const { return allAttributes.size(); }; - const TableS * getTable() const { return m_currentTable;}; - const AttributeS * operator[](int i) const { return allAttributes[i];}; - Uint32 * getDataRecord() { return dataRecord;}; - void createDataRecord(Uint32 bytes) { dataRecord = new Uint32[bytes];}; + TupleS() { + m_currentTable= 0; + allAttrData= 0; + }; + ~TupleS() + { + if (allAttrData) + delete [] allAttrData; + }; + TupleS(const TupleS& tuple); // disable copy constructor + TupleS & operator=(const TupleS& tuple); + int getNoOfAttributes() const; + const TableS * getTable() const; + const AttributeDesc * getDesc(int i) const; + AttributeData * getData(int i) const; }; // class TupleS class TableS { @@ -118,46 +119,28 @@ class TableS { friend class RestoreMetaData; friend class RestoreDataIterator; - Uint32 tableId; - char tableName[TableNameLenC]; Uint32 schemaVersion; Uint32 backupVersion; - myVector allAttributesDesc; - myVector m_fixedKeys; - //myVector m_variableKey; - myVector m_fixedAttribs; - myVector m_variableAttribs; + Vector allAttributesDesc; + Vector m_fixedKeys; + //Vector m_variableKey; + Vector m_fixedAttribs; + Vector m_variableAttribs; Uint32 m_noOfNullable; Uint32 m_nullBitmaskSize; int pos; - char create_string[2048]; - /* - char mysqlTableName[1024]; - char mysqlDatabaseName[1024]; - */ - void createAttr(const char* name, - const AttrType type, - const unsigned int size, // in bits - const unsigned int arraySize, - const bool nullable, - const KeyType key); + void createAttr(NdbDictionary::Column *column); public: class NdbDictionary::Table* m_dictTable; - TableS (const char * name){ - snprintf(tableName, sizeof(tableName), name); - m_noOfNullable = m_nullBitmaskSize = 0; - } + TableS (class NdbTableImpl* dictTable); + ~TableS(); - void setTableId (Uint32 id) { - tableId = id; - } - Uint32 getTableId() const { - return tableId; + return m_dictTable->getTableId(); } /* void setMysqlTableName(char * tableName) { @@ -174,7 +157,6 @@ public: void setBackupVersion(Uint32 version) { backupVersion = version; } - Uint32 getBackupVersion() const { return backupVersion; @@ -208,18 +190,26 @@ protected: BackupFormat::FileHeader m_expectedFileHeader; Uint32 m_nodeId; - Uint32 * m_buffer; - Uint32 m_bufferSize; - Uint32 * createBuffer(Uint32 bytes); + void * m_buffer; + void * m_buffer_ptr; + Uint32 m_buffer_sz; + Uint32 m_buffer_data_left; + void (* free_data_callback)(); + bool openFile(); void setCtlFile(Uint32 nodeId, Uint32 backupId, const char * path); void setDataFile(const BackupFile & bf, Uint32 no); void setLogFile(const BackupFile & bf, Uint32 no); + Uint32 buffer_get_ptr(void **p_buf_ptr, Uint32 size, Uint32 nmemb); + Uint32 buffer_read(void *ptr, Uint32 size, Uint32 nmemb); + Uint32 buffer_get_ptr_ahead(void **p_buf_ptr, Uint32 size, Uint32 nmemb); + Uint32 buffer_read_ahead(void *ptr, Uint32 size, Uint32 nmemb); + void setName(const char * path, const char * name); - BackupFile(); + BackupFile(void (* free_data_callback)() = 0); ~BackupFile(); public: bool readHeader(); @@ -229,12 +219,12 @@ public: const char * getFilename() const { return m_fileName;} Uint32 getNodeId() const { return m_nodeId;} const BackupFormat::FileHeader & getFileHeader() const { return m_fileHeader;} - bool Twiddle(AttributeS * attr, Uint32 arraySize = 0); + bool Twiddle(const AttributeDesc * attr_desc, AttributeData * attr_data, Uint32 arraySize = 0); }; class RestoreMetaData : public BackupFile { - myVector allTables; + Vector allTables; bool readMetaFileHeader(); bool readMetaTableDesc(); @@ -247,14 +237,11 @@ class RestoreMetaData : public BackupFile { bool parseTableDescriptor(const Uint32 * data, Uint32 len); public: - RestoreMetaData(const char * path, Uint32 nodeId, Uint32 bNo); - ~RestoreMetaData(); + virtual ~RestoreMetaData(); int loadContent(); - - Uint32 getNoOfTables() const { return allTables.size();} const TableS * operator[](int i) const { return allTables[i];} @@ -266,20 +253,20 @@ public: class RestoreDataIterator : public BackupFile { const RestoreMetaData & m_metaData; - Uint32 m_count; - TupleS m_tuple; const TableS* m_currentTable; + TupleS m_tuple; + public: // Constructor - RestoreDataIterator(const RestoreMetaData &); - ~RestoreDataIterator(); + RestoreDataIterator(const RestoreMetaData &, void (* free_data_callback)()); + ~RestoreDataIterator() {}; // Read data file fragment header bool readFragmentHeader(int & res); bool validateFragmentFooter(); - + const TupleS *getNextTuple(int & res); }; @@ -292,9 +279,35 @@ public: }; EntryType m_type; const TableS * m_table; - myVector m_values; - - + Vector m_values; + Vector m_values_e; + AttributeS *add_attr() { + AttributeS * attr; + if (m_values_e.size() > 0) { + attr = m_values_e[m_values_e.size()-1]; + m_values_e.erase(m_values_e.size()-1); + } + else + { + attr = new AttributeS; + } + m_values.push_back(attr); + return attr; + } + void clear() { + for(Uint32 i= 0; i < m_values.size(); i++) + m_values_e.push_back(m_values[i]); + m_values.clear(); + } + ~LogEntry() + { + for(Uint32 i= 0; i< m_values.size(); i++) + delete m_values[i]; + for(Uint32 i= 0; i< m_values_e.size(); i++) + delete m_values_e[i]; + } + Uint32 size() const { return m_values.size(); } + const AttributeS * operator[](int i) const { return m_values[i];} }; class RestoreLogIterator : public BackupFile { @@ -305,10 +318,16 @@ private: LogEntry m_logEntry; public: RestoreLogIterator(const RestoreMetaData &); - + virtual ~RestoreLogIterator() {}; + const LogEntry * getNextLogEntry(int & res); }; +NdbOut& operator<<(NdbOut& ndbout, const TableS&); +NdbOut& operator<<(NdbOut& ndbout, const TupleS&); +NdbOut& operator<<(NdbOut& ndbout, const LogEntry&); +NdbOut& operator<<(NdbOut& ndbout, const RestoreMetaData&); + #endif diff --git a/ndb/src/kernel/blocks/backup/restore/consumer.cpp b/ndb/src/kernel/blocks/backup/restore/consumer.cpp new file mode 100644 index 00000000000..e94c31b2666 --- /dev/null +++ b/ndb/src/kernel/blocks/backup/restore/consumer.cpp @@ -0,0 +1,107 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "consumer.hpp" + +#ifdef USE_MYSQL +int +BackupConsumer::create_table_string(const TableS & table, + char * tableName, + char *buf){ + int pos = 0; + int pos2 = 0; + char buf2[2048]; + + pos += sprintf(buf+pos, "%s%s", "CREATE TABLE ", tableName); + pos += sprintf(buf+pos, "%s", "("); + pos2 += sprintf(buf2+pos2, "%s", " primary key("); + + for (int j = 0; j < table.getNoOfAttributes(); j++) + { + const AttributeDesc * desc = table[j]; + // ndbout << desc->name << ": "; + pos += sprintf(buf+pos, "%s%s", desc->m_column->getName()," "); + switch(desc->m_column->getType()){ + case NdbDictionary::Column::Int: + pos += sprintf(buf+pos, "%s", "int"); + break; + case NdbDictionary::Column::Unsigned: + pos += sprintf(buf+pos, "%s", "int unsigned"); + break; + case NdbDictionary::Column::Float: + pos += sprintf(buf+pos, "%s", "float"); + break; + case NdbDictionary::Column::Decimal: + pos += sprintf(buf+pos, "%s", "decimal"); + break; + case NdbDictionary::Column::Char: + pos += sprintf(buf+pos, "%s", "char"); + break; + case NdbDictionary::Column::Varchar: + pos += sprintf(buf+pos, "%s", "varchar"); + break; + case NdbDictionary::Column::Binary: + pos += sprintf(buf+pos, "%s", "binary"); + break; + case NdbDictionary::Column::Varbinary: + pos += sprintf(buf+pos, "%s", "varchar binary"); + break; + case NdbDictionary::Column::Bigint: + pos += sprintf(buf+pos, "%s", "bigint"); + break; + case NdbDictionary::Column::Bigunsigned: + pos += sprintf(buf+pos, "%s", "bigint unsigned"); + break; + case NdbDictionary::Column::Double: + pos += sprintf(buf+pos, "%s", "double"); + break; + case NdbDictionary::Column::Datetime: + pos += sprintf(buf+pos, "%s", "datetime"); + break; + case NdbDictionary::Column::Timespec: + pos += sprintf(buf+pos, "%s", "time"); + break; + case NdbDictionary::Column::Undefined: + // pos += sprintf(buf+pos, "%s", "varchar binary"); + return -1; + break; + default: + //pos += sprintf(buf+pos, "%s", "varchar binary"); + return -1; + } + if (desc->arraySize > 1) { + int attrSize = desc->arraySize; + pos += sprintf(buf+pos, "%s%u%s", + "(", + attrSize, + ")"); + } + if (desc->m_column->getPrimaryKey()) { + pos += sprintf(buf+pos, "%s", " not null"); + pos2 += sprintf(buf2+pos2, "%s%s", desc->m_column->getName(), ","); + } + pos += sprintf(buf+pos, "%s", ","); + } // for + pos2--; // remove trailing comma + pos2 += sprintf(buf2+pos2, "%s", ")"); + // pos--; // remove trailing comma + + pos += sprintf(buf+pos, "%s", buf2); + pos += sprintf(buf+pos, "%s", ") type=ndbcluster"); + return 0; +} + +#endif // USE_MYSQL diff --git a/ndb/src/kernel/blocks/backup/restore/consumer.hpp b/ndb/src/kernel/blocks/backup/restore/consumer.hpp new file mode 100644 index 00000000000..e3ba2041a22 --- /dev/null +++ b/ndb/src/kernel/blocks/backup/restore/consumer.hpp @@ -0,0 +1,34 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef CONSUMER_HPP +#define CONSUMER_HPP + +#include "Restore.hpp" + +class BackupConsumer { +public: + virtual ~BackupConsumer() { } + virtual bool init() { return true;} + virtual bool table(const TableS &){return true;} + virtual void tuple(const TupleS &){} + virtual void tuple_free(){} + virtual void endOfTuples(){} + virtual void logEntry(const LogEntry &){} + virtual void endOfLogEntrys(){} +}; + +#endif diff --git a/ndb/src/kernel/blocks/backup/restore/consumer_printer.cpp b/ndb/src/kernel/blocks/backup/restore/consumer_printer.cpp new file mode 100644 index 00000000000..0aa5b521d29 --- /dev/null +++ b/ndb/src/kernel/blocks/backup/restore/consumer_printer.cpp @@ -0,0 +1,55 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "consumer_printer.hpp" + +bool +BackupPrinter::table(const TableS & tab) +{ + if (m_print || m_print_meta) + { + m_ndbout << tab; + ndbout_c("Successfully printed table: %s", tab.m_dictTable->getName()); + } + return true; +} + +void +BackupPrinter::tuple(const TupleS & tup) +{ + m_dataCount++; + if (m_print || m_print_data) + m_ndbout << tup << endl; +} + +void +BackupPrinter::logEntry(const LogEntry & logE) +{ + if (m_print || m_print_log) + m_ndbout << logE << endl; + m_logCount++; +} + +void +BackupPrinter::endOfLogEntrys() +{ + if (m_print || m_print_log) + { + ndbout << "Printed " << m_dataCount << " tuples and " + << m_logCount << " log entries" + << " to stdout." << endl; + } +} diff --git a/ndb/src/kernel/blocks/backup/restore/consumer_printer.hpp b/ndb/src/kernel/blocks/backup/restore/consumer_printer.hpp new file mode 100644 index 00000000000..7cbc924e364 --- /dev/null +++ b/ndb/src/kernel/blocks/backup/restore/consumer_printer.hpp @@ -0,0 +1,50 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef CONSUMER_PRINTER_HPP +#define CONSUMER_PRINTER_HPP + +#include "consumer.hpp" + +class BackupPrinter : public BackupConsumer +{ + NdbOut & m_ndbout; +public: + BackupPrinter(NdbOut & out = ndbout) : m_ndbout(out) + { + m_print = false; + m_print_log = false; + m_print_data = false; + m_print_meta = false; + } + + virtual bool table(const TableS &); +#ifdef USE_MYSQL + virtual bool table(const TableS &, MYSQL* mysqlp); +#endif + virtual void tuple(const TupleS &); + virtual void logEntry(const LogEntry &); + virtual void endOfTuples() {}; + virtual void endOfLogEntrys(); + bool m_print; + bool m_print_log; + bool m_print_data; + bool m_print_meta; + Uint32 m_logCount; + Uint32 m_dataCount; +}; + +#endif diff --git a/ndb/src/kernel/blocks/backup/restore/consumer_restore.cpp b/ndb/src/kernel/blocks/backup/restore/consumer_restore.cpp new file mode 100644 index 00000000000..5731a9a3883 --- /dev/null +++ b/ndb/src/kernel/blocks/backup/restore/consumer_restore.cpp @@ -0,0 +1,516 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "consumer_restore.hpp" +#include + +extern FilteredNdbOut err; +extern FilteredNdbOut info; +extern FilteredNdbOut debug; + +static void callback(int, NdbConnection*, void*); + +bool +BackupRestore::init() +{ + release(); + + if (!m_restore && !m_restore_meta) + return true; + + m_ndb = new Ndb(); + + if (m_ndb == NULL) + return false; + + // Turn off table name completion + m_ndb->useFullyQualifiedNames(false); + + m_ndb->init(1024); + if (m_ndb->waitUntilReady(30) != 0) + { + err << "Failed to connect to ndb!!" << endl; + return false; + } + info << "Connected to ndb!!" << endl; + + m_callback = new restore_callback_t[m_parallelism]; + + if (m_callback == 0) + { + err << "Failed to allocate callback structs" << endl; + return false; + } + + m_tuples = new TupleS[m_parallelism]; + + if (m_tuples == 0) + { + err << "Failed to allocate tuples" << endl; + return false; + } + + m_free_callback= m_callback; + for (Uint32 i= 0; i < m_parallelism; i++) { + m_callback[i].restore= this; + m_callback[i].connection= 0; + m_callback[i].tup= &m_tuples[i]; + if (i > 0) + m_callback[i-1].next= &(m_callback[i]); + } + m_callback[m_parallelism-1].next = 0; + + return true; +} + +void BackupRestore::release() +{ + if (m_ndb) + { + delete m_ndb; + m_ndb= 0; + } + + if (m_callback) + { + delete [] m_callback; + m_callback= 0; + } + + if (m_tuples) + { + delete [] m_tuples; + m_tuples= 0; + } +} + +BackupRestore::~BackupRestore() +{ + release(); +} + +bool +BackupRestore::table(const TableS & table){ + if (!m_restore_meta) + return true; + + NdbDictionary::Dictionary* dict = m_ndb->getDictionary(); + if (dict->createTable(*table.m_dictTable) == -1) + { + err << "Create table " << table.getTableName() << " failed: " + << dict->getNdbError() << endl; + return false; + } + info << "Successfully restored table " << table.getTableName()<< endl ; + return true; +} + +void BackupRestore::tuple(const TupleS & tup) +{ + if (!m_restore) + return; + + restore_callback_t * cb = m_free_callback; + + if (cb == 0) + assert(false); + + m_free_callback = cb->next; + cb->retries = 0; + *(cb->tup) = tup; // must do copy! + tuple_a(cb); + + if (m_free_callback == 0) + { + // send-poll all transactions + // close transaction is done in callback + m_ndb->sendPollNdb(3000, 1); + } +} + +void BackupRestore::tuple_a(restore_callback_t *cb) +{ + while (cb->retries < 10) + { + /** + * start transactions + */ + cb->connection = m_ndb->startTransaction(); + if (cb->connection == NULL) + { + /* + if (errorHandler(cb)) + { + continue; + } + */ + exitHandler(); + } // if + + const TupleS &tup = *(cb->tup); + const TableS * table = tup.getTable(); + NdbOperation * op = cb->connection->getNdbOperation(table->getTableName()); + + if (op == NULL) + { + if (errorHandler(cb)) + continue; + exitHandler(); + } // if + + if (op->writeTuple() == -1) + { + if (errorHandler(cb)) + continue; + exitHandler(); + } // if + + int ret = 0; + for (int j = 0; j < 2; j++) + { + for (int i = 0; i < tup.getNoOfAttributes(); i++) + { + const AttributeDesc * attr_desc = tup.getDesc(i); + const AttributeData * attr_data = tup.getData(i); + int size = attr_desc->size; + int arraySize = attr_desc->arraySize; + char * dataPtr = attr_data->string_value; + Uint32 length = (size * arraySize) / 8; + if (attr_desc->m_column->getPrimaryKey()) + { + if (j == 1) continue; + ret = op->equal(i, dataPtr, length); + } + else + { + if (j == 0) continue; + if (attr_data->null) + ret = op->setValue(i, NULL, 0); + else + ret = op->setValue(i, dataPtr, length); + } + if (ret < 0) { + ndbout_c("Column: %d type %d",i, + attr_desc->m_column->getType()); + break; + } + } + if (ret < 0) + break; + } + if (ret < 0) + { + if (errorHandler(cb)) + continue; + exitHandler(); + } + + // Prepare transaction (the transaction is NOT yet sent to NDB) + cb->connection->executeAsynchPrepare(Commit, &callback, cb); + m_transactions++; + return; + } + err << "Unable to recover from errors. Exiting..." << endl; + exitHandler(); +} + +void BackupRestore::cback(int result, restore_callback_t *cb) +{ + m_transactions--; + + if (result < 0) + { + /** + * Error. temporary or permanent? + */ + if (errorHandler(cb)) + tuple_a(cb); // retry + else + { + err << "Restore: Failed to restore data due to a unrecoverable error. Exiting..." << endl; + exitHandler(); + } + } + else + { + /** + * OK! close transaction + */ + m_ndb->closeTransaction(cb->connection); + cb->connection= 0; + cb->next= m_free_callback; + m_free_callback= cb; + m_dataCount++; + } +} + +/** + * returns true if is recoverable, + * Error handling based on hugo + * false if it is an error that generates an abort. + */ +bool BackupRestore::errorHandler(restore_callback_t *cb) +{ + NdbError error= cb->connection->getNdbError(); + m_ndb->closeTransaction(cb->connection); + cb->connection= 0; + cb->retries++; + switch(error.status) + { + case NdbError::Success: + return false; + // ERROR! + break; + + case NdbError::TemporaryError: + NdbSleep_MilliSleep(10); + return true; + // RETRY + break; + + case NdbError::UnknownResult: + err << error << endl; + return false; + // ERROR! + break; + + default: + case NdbError::PermanentError: + switch (error.code) + { + case 499: + case 250: + NdbSleep_MilliSleep(10); + return true; //temp errors? + default: + break; + } + //ERROR + err << error << endl; + return false; + break; + } + return false; +} + +void BackupRestore::exitHandler() +{ + release(); + exit(-1); +} + + +void +BackupRestore::tuple_free() +{ + if (!m_restore) + return; + + if (m_transactions > 0) { + // Send all transactions to NDB + m_ndb->sendPreparedTransactions(0); + + // Poll all transactions + while (m_transactions > 0) + m_ndb->pollNdb(3000, m_transactions); + } +} + +void +BackupRestore::endOfTuples() +{ + tuple_free(); +} + +void +BackupRestore::logEntry(const LogEntry & tup) +{ + if (!m_restore) + return; + + NdbConnection * trans = m_ndb->startTransaction(); + if (trans == NULL) + { + // Deep shit, TODO: handle the error + err << "Cannot start transaction" << endl; + exit(-1); + } // if + + const TableS * table = tup.m_table; + NdbOperation * op = trans->getNdbOperation(table->getTableName()); + if (op == NULL) + { + err << "Cannot get operation: " << trans->getNdbError() << endl; + exit(-1); + } // if + + int check = 0; + switch(tup.m_type) + { + case LogEntry::LE_INSERT: + check = op->insertTuple(); + break; + case LogEntry::LE_UPDATE: + check = op->updateTuple(); + break; + case LogEntry::LE_DELETE: + check = op->deleteTuple(); + break; + default: + err << "Log entry has wrong operation type." + << " Exiting..."; + exit(-1); + } + + for (Uint32 i= 0; i < tup.size(); i++) + { + const AttributeS * attr = tup[i]; + int size = attr->Desc->size; + int arraySize = attr->Desc->arraySize; + const char * dataPtr = attr->Data.string_value; + + const Uint32 length = (size / 8) * arraySize; + if (attr->Desc->m_column->getPrimaryKey()) + op->equal(attr->Desc->attrId, dataPtr, length); + else + op->setValue(attr->Desc->attrId, dataPtr, length); + } + + const int ret = trans->execute(Commit); + if (ret != 0) + { + // Both insert update and delete can fail during log running + // and it's ok + // TODO: check that the error is either tuple exists or tuple does not exist? + switch(tup.m_type) + { + case LogEntry::LE_INSERT: + break; + case LogEntry::LE_UPDATE: + break; + case LogEntry::LE_DELETE: + break; + } + if (false) + { + err << "execute failed: " << trans->getNdbError() << endl; + exit(-1); + } + } + + m_ndb->closeTransaction(trans); + m_logCount++; +} + +void +BackupRestore::endOfLogEntrys() +{ + if (!m_restore) + return; + + info << "Restored " << m_dataCount << " tuples and " + << m_logCount << " log entries" << endl; +} + +/* + * callback : This is called when the transaction is polled + * + * (This function must have three arguments: + * - The result of the transaction, + * - The NdbConnection object, and + * - A pointer to an arbitrary object.) + */ + +static void +callback(int result, NdbConnection* trans, void* aObject) +{ + restore_callback_t *cb = (restore_callback_t *)aObject; + (cb->restore)->cback(result, cb); +} + +#if 0 // old tuple impl +void +BackupRestore::tuple(const TupleS & tup) +{ + if (!m_restore) + return; + while (1) + { + NdbConnection * trans = m_ndb->startTransaction(); + if (trans == NULL) + { + // Deep shit, TODO: handle the error + ndbout << "Cannot start transaction" << endl; + exit(-1); + } // if + + const TableS * table = tup.getTable(); + NdbOperation * op = trans->getNdbOperation(table->getTableName()); + if (op == NULL) + { + ndbout << "Cannot get operation: "; + ndbout << trans->getNdbError() << endl; + exit(-1); + } // if + + // TODO: check return value and handle error + if (op->writeTuple() == -1) + { + ndbout << "writeTuple call failed: "; + ndbout << trans->getNdbError() << endl; + exit(-1); + } // if + + for (int i = 0; i < tup.getNoOfAttributes(); i++) + { + const AttributeS * attr = tup[i]; + int size = attr->Desc->size; + int arraySize = attr->Desc->arraySize; + const char * dataPtr = attr->Data.string_value; + + const Uint32 length = (size * arraySize) / 8; + if (attr->Desc->m_column->getPrimaryKey()) + op->equal(i, dataPtr, length); + } + + for (int i = 0; i < tup.getNoOfAttributes(); i++) + { + const AttributeS * attr = tup[i]; + int size = attr->Desc->size; + int arraySize = attr->Desc->arraySize; + const char * dataPtr = attr->Data.string_value; + + const Uint32 length = (size * arraySize) / 8; + if (!attr->Desc->m_column->getPrimaryKey()) + if (attr->Data.null) + op->setValue(i, NULL, 0); + else + op->setValue(i, dataPtr, length); + } + int ret = trans->execute(Commit); + if (ret != 0) + { + ndbout << "execute failed: "; + ndbout << trans->getNdbError() << endl; + exit(-1); + } + m_ndb->closeTransaction(trans); + if (ret == 0) + break; + } + m_dataCount++; +} +#endif diff --git a/ndb/src/kernel/blocks/backup/restore/consumer_restore.hpp b/ndb/src/kernel/blocks/backup/restore/consumer_restore.hpp new file mode 100644 index 00000000000..2d36501bf40 --- /dev/null +++ b/ndb/src/kernel/blocks/backup/restore/consumer_restore.hpp @@ -0,0 +1,75 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef CONSUMER_RESTORE_HPP +#define CONSUMER_RESTORE_HPP + +#include "consumer.hpp" + +struct restore_callback_t { + class BackupRestore *restore; + class TupleS *tup; + class NdbConnection *connection; + int retries; + restore_callback_t *next; +}; + + +class BackupRestore : public BackupConsumer +{ +public: + BackupRestore(Uint32 parallelism=1) + { + m_ndb = 0; + m_logCount = m_dataCount = 0; + m_restore = false; + m_restore_meta = false; + m_parallelism = parallelism; + m_callback = 0; + m_tuples = 0; + m_free_callback = 0; + m_transactions = 0; + } + + virtual ~BackupRestore(); + virtual bool init(); + virtual void release(); + virtual bool table(const TableS &); + virtual void tuple(const TupleS &); + virtual void tuple_free(); + virtual void tuple_a(restore_callback_t *cb); + virtual void cback(int result, restore_callback_t *cb); + virtual bool errorHandler(restore_callback_t *cb); + virtual void exitHandler(); + virtual void endOfTuples(); + virtual void logEntry(const LogEntry &); + virtual void endOfLogEntrys(); + void connectToMysql(); + Ndb * m_ndb; + bool m_restore; + bool m_restore_meta; + Uint32 m_logCount; + Uint32 m_dataCount; + + Uint32 m_parallelism; + Uint32 m_transactions; + + TupleS *m_tuples; + restore_callback_t *m_callback; + restore_callback_t *m_free_callback; +}; + +#endif diff --git a/ndb/src/kernel/blocks/backup/restore/consumer_restorem.cpp b/ndb/src/kernel/blocks/backup/restore/consumer_restorem.cpp new file mode 100644 index 00000000000..6a9ec07148a --- /dev/null +++ b/ndb/src/kernel/blocks/backup/restore/consumer_restorem.cpp @@ -0,0 +1,652 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "consumer_restore.hpp" +#include + +extern FilteredNdbOut err; +extern FilteredNdbOut info; +extern FilteredNdbOut debug; + +static bool asynchErrorHandler(NdbConnection * trans, Ndb * ndb); +static void callback(int result, NdbConnection* trans, void* aObject); + +bool +BackupRestore::init() +{ + + if (!m_restore && !m_restore_meta) + return true; + + m_ndb = new Ndb(); + + if (m_ndb == NULL) + return false; + + // Turn off table name completion + m_ndb->useFullyQualifiedNames(false); + + m_ndb->init(1024); + if (m_ndb->waitUntilReady(30) != 0) + { + ndbout << "Failed to connect to ndb!!" << endl; + return false; + } + ndbout << "Connected to ndb!!" << endl; + +#if USE_MYSQL + if(use_mysql) + { + if ( mysql_thread_safe() == 0 ) + { + ndbout << "Not thread safe mysql library..." << endl; + exit(-1); + } + + ndbout << "Connecting to MySQL..." < 0) + m_callback[i-1].next = &(m_callback[i]); + } + m_callback[m_parallelism-1].next = 0; + + return true; + +} + +BackupRestore::~BackupRestore() +{ + if (m_ndb != 0) + delete m_ndb; + + if (m_callback) + delete [] m_callback; +} + +#ifdef USE_MYSQL +bool +BackupRestore::table(const TableS & table, MYSQL * mysqlp){ + if (!m_restore_meta) + { + return true; + } + + char tmpTabName[MAX_TAB_NAME_SIZE*2]; + sprintf(tmpTabName, "%s", table.getTableName()); + char * database = strtok(tmpTabName, "/"); + char * schema = strtok( NULL , "/"); + char * tableName = strtok( NULL , "/"); + + /** + * this means that the user did not specify schema + * and it is a v2x backup + */ + if(database == NULL) + return false; + if(schema == NULL) + return false; + if(tableName==NULL) + tableName = schema; + + char stmtCreateDB[255]; + sprintf(stmtCreateDB,"CREATE DATABASE %s", database); + + /*ignore return value. mysql_select_db will trap errors anyways*/ + if (mysql_query(mysqlp,stmtCreateDB) == 0) + { + //ndbout_c("%s", stmtCreateDB); + } + + if (mysql_select_db(&mysql, database) != 0) + { + ndbout_c("Error: %s", mysql_error(&mysql)); + return false; + } + + char buf [2048]; + /** + * create table ddl + */ + if (create_table_string(table, tableName, buf)) + { + ndbout_c("Unable to create a table definition since the " + "backup contains undefined types"); + return false; + } + + //ndbout_c("%s", buf); + + if (mysql_query(mysqlp,buf) != 0) + { + ndbout_c("Error: %s", mysql_error(&mysql)); + return false; + } else + { + ndbout_c("Successfully restored table %s into database %s", tableName, database); + } + + return true; +} +#endif + +bool +BackupRestore::table(const TableS & table){ + if (!m_restore_meta) + { + return true; + } + NdbDictionary::Dictionary* dict = m_ndb->getDictionary(); + if (dict->createTable(*table.m_dictTable) == -1) + { + err << "Create table " << table.getTableName() << " failed: " + << dict->getNdbError() << endl; + return false; + } + info << "Successfully restored table " << table.getTableName()<< endl ; + return true; +} + +void BackupRestore::tuple(const TupleS & tup) +{ + if (!m_restore) + { + delete &tup; + return; + } + + restore_callback_t * cb = m_free_callback; + + if (cb) + { + m_free_callback = cb->next; + cb->retries = 0; + cb->tup = &tup; + tuple_a(cb); + } + + if (m_free_callback == 0) + { + // send-poll all transactions + // close transaction is done in callback + m_ndb->sendPollNdb(3000, 1); + } +} + +void BackupRestore::tuple_a(restore_callback_t *cb) +{ + while (cb->retries < 10) + { + /** + * start transactions + */ + cb->connection = m_ndb->startTransaction(); + if (cb->connection == NULL) + { + /* + if (asynchErrorHandler(cb->connection, m_ndb)) + { + cb->retries++; + continue; + } + */ + asynchExitHandler(); + } // if + + const TupleS &tup = *(cb->tup); + const TableS * table = tup.getTable(); + NdbOperation * op = cb->connection->getNdbOperation(table->getTableName()); + + if (op == NULL) + { + if (asynchErrorHandler(cb->connection, m_ndb)) + { + cb->retries++; + continue; + } + asynchExitHandler(); + } // if + + if (op->writeTuple() == -1) + { + if (asynchErrorHandler(cb->connection, m_ndb)) + { + cb->retries++; + continue; + } + asynchExitHandler(); + } // if + + Uint32 ret = 0; + for (int i = 0; i < tup.getNoOfAttributes(); i++) + { + const AttributeS * attr = tup[i]; + int size = attr->Desc->size; + int arraySize = attr->Desc->arraySize; + char * dataPtr = attr->Data.string_value; + Uint32 length = (size * arraySize) / 8; + if (attr->Desc->m_column->getPrimaryKey()) + { + ret = op->equal(i, dataPtr, length); + } + else + { + if (attr->Data.null) + ret = op->setValue(i, NULL, 0); + else + ret = op->setValue(i, dataPtr, length); + } + + if (ret<0) + { + ndbout_c("Column: %d type %d",i, + tup.getTable()->m_dictTable->getColumn(i)->getType()); + if (asynchErrorHandler(cb->connection, m_ndb)) + { + cb->retries++; + break; + } + asynchExitHandler(); + } + } + if (ret < 0) + continue; + + // Prepare transaction (the transaction is NOT yet sent to NDB) + cb->connection->executeAsynchPrepare(Commit, &callback, cb); + m_transactions++; + } + ndbout_c("Unable to recover from errors. Exiting..."); + asynchExitHandler(); +} + +void BackupRestore::cback(int result, restore_callback_t *cb) +{ + if (result<0) + { + /** + * Error. temporary or permanent? + */ + if (asynchErrorHandler(cb->connection, m_ndb)) + { + cb->retries++; + tuple_a(cb); + } + else + { + ndbout_c("Restore: Failed to restore data " + "due to a unrecoverable error. Exiting..."); + delete m_ndb; + delete cb->tup; + exit(-1); + } + } + else + { + /** + * OK! close transaction + */ + m_ndb->closeTransaction(cb->connection); + delete cb->tup; + m_transactions--; + } +} + +void BackupRestore::asynchExitHandler() +{ + if (m_ndb != NULL) + delete m_ndb; + exit(-1); +} + +#if 0 // old tuple impl +void +BackupRestore::tuple(const TupleS & tup) +{ + if (!m_restore) + return; + while (1) + { + NdbConnection * trans = m_ndb->startTransaction(); + if (trans == NULL) + { + // Deep shit, TODO: handle the error + ndbout << "Cannot start transaction" << endl; + exit(-1); + } // if + + const TableS * table = tup.getTable(); + NdbOperation * op = trans->getNdbOperation(table->getTableName()); + if (op == NULL) + { + ndbout << "Cannot get operation: "; + ndbout << trans->getNdbError() << endl; + exit(-1); + } // if + + // TODO: check return value and handle error + if (op->writeTuple() == -1) + { + ndbout << "writeTuple call failed: "; + ndbout << trans->getNdbError() << endl; + exit(-1); + } // if + + for (int i = 0; i < tup.getNoOfAttributes(); i++) + { + const AttributeS * attr = tup[i]; + int size = attr->Desc->size; + int arraySize = attr->Desc->arraySize; + const char * dataPtr = attr->Data.string_value; + + const Uint32 length = (size * arraySize) / 8; + if (attr->Desc->m_column->getPrimaryKey()) + op->equal(i, dataPtr, length); + } + + for (int i = 0; i < tup.getNoOfAttributes(); i++) + { + const AttributeS * attr = tup[i]; + int size = attr->Desc->size; + int arraySize = attr->Desc->arraySize; + const char * dataPtr = attr->Data.string_value; + + const Uint32 length = (size * arraySize) / 8; + if (!attr->Desc->m_column->getPrimaryKey()) + if (attr->Data.null) + op->setValue(i, NULL, 0); + else + op->setValue(i, dataPtr, length); + } + int ret = trans->execute(Commit); + if (ret != 0) + { + ndbout << "execute failed: "; + ndbout << trans->getNdbError() << endl; + exit(-1); + } + m_ndb->closeTransaction(trans); + if (ret == 0) + break; + } + m_dataCount++; +} +#endif + +void +BackupRestore::endOfTuples() +{ + if (!m_restore) + return; + + // Send all transactions to NDB + m_ndb->sendPreparedTransactions(0); + + // Poll all transactions + m_ndb->pollNdb(3000, m_transactions); + + // Close all transactions + // for (int i = 0; i < nPreparedTransactions; i++) + // m_ndb->closeTransaction(asynchTrans[i]); +} + +void +BackupRestore::logEntry(const LogEntry & tup) +{ + if (!m_restore) + return; + + NdbConnection * trans = m_ndb->startTransaction(); + if (trans == NULL) + { + // Deep shit, TODO: handle the error + ndbout << "Cannot start transaction" << endl; + exit(-1); + } // if + + const TableS * table = tup.m_table; + NdbOperation * op = trans->getNdbOperation(table->getTableName()); + if (op == NULL) + { + ndbout << "Cannot get operation: "; + ndbout << trans->getNdbError() << endl; + exit(-1); + } // if + + int check = 0; + switch(tup.m_type) + { + case LogEntry::LE_INSERT: + check = op->insertTuple(); + break; + case LogEntry::LE_UPDATE: + check = op->updateTuple(); + break; + case LogEntry::LE_DELETE: + check = op->deleteTuple(); + break; + default: + ndbout << "Log entry has wrong operation type." + << " Exiting..."; + exit(-1); + } + + for (int i = 0; i < tup.m_values.size(); i++) + { + const AttributeS * attr = tup.m_values[i]; + int size = attr->Desc->size; + int arraySize = attr->Desc->arraySize; + const char * dataPtr = attr->Data.string_value; + + const Uint32 length = (size / 8) * arraySize; + if (attr->Desc->m_column->getPrimaryKey()) + op->equal(attr->Desc->attrId, dataPtr, length); + else + op->setValue(attr->Desc->attrId, dataPtr, length); + } + +#if 1 + trans->execute(Commit); +#else + const int ret = trans->execute(Commit); + // Both insert update and delete can fail during log running + // and it's ok + + if (ret != 0) + { + ndbout << "execute failed: "; + ndbout << trans->getNdbError() << endl; + exit(-1); + } +#endif + + m_ndb->closeTransaction(trans); + m_logCount++; +} + +void +BackupRestore::endOfLogEntrys() +{ + if (m_restore) + { + ndbout << "Restored " << m_dataCount << " tuples and " + << m_logCount << " log entries" << endl; + } +} +#if 0 +/***************************************** + * + * Callback function for asynchronous transactions + * + * Idea for error handling: Transaction objects have to be stored globally when + * they are prepared. + * In the callback function if the transaction: + * succeeded: delete the object from global storage + * failed but can be retried: execute the object that is in global storage + * failed but fatal: delete the object from global storage + * + ******************************************/ +static void restoreCallback(int result, // Result for transaction + NdbConnection *object, // Transaction object + void *anything) // Not used +{ + static Uint32 counter = 0; + + + debug << "restoreCallback function called " << counter << " time(s)" << endl; + + ++counter; + + if (result == -1) + { + ndbout << " restoreCallback (" << counter; + if ((counter % 10) == 1) + { + ndbout << "st"; + } // if + else if ((counter % 10) == 2) + { + ndbout << "nd"; + } // else if + else if ((counter % 10 ) ==3) + { + ndbout << "rd"; + } // else if + else + { + ndbout << "th"; + } // else + err << " time: error detected " << object->getNdbError() << endl; + } // if + +} // restoreCallback +#endif + + + +/* + * callback : This is called when the transaction is polled + * + * (This function must have three arguments: + * - The result of the transaction, + * - The NdbConnection object, and + * - A pointer to an arbitrary object.) + */ + +static void +callback(int result, NdbConnection* trans, void* aObject) +{ + restore_callback_t *cb = (restore_callback_t *)aObject; + (cb->restore)->cback(result, cb); +} + +/** + * returns true if is recoverable, + * Error handling based on hugo + * false if it is an error that generates an abort. + */ +static +bool asynchErrorHandler(NdbConnection * trans, Ndb* ndb) +{ + NdbError error = trans->getNdbError(); + ndb->closeTransaction(trans); + switch(error.status) + { + case NdbError::Success: + return false; + // ERROR! + break; + + case NdbError::TemporaryError: + NdbSleep_MilliSleep(10); + return true; + // RETRY + break; + + case NdbError::UnknownResult: + ndbout << error << endl; + return false; + // ERROR! + break; + + default: + case NdbError::PermanentError: + switch (error.code) + { + case 499: + case 250: + NdbSleep_MilliSleep(10); + return true; //temp errors? + default: + break; + } + //ERROR + ndbout << error << endl; + return false; + break; + } + return false; +} diff --git a/ndb/src/kernel/blocks/backup/restore/main.cpp b/ndb/src/kernel/blocks/backup/restore/main.cpp index 1df82a7f055..99deeb3115c 100644 --- a/ndb/src/kernel/blocks/backup/restore/main.cpp +++ b/ndb/src/kernel/blocks/backup/restore/main.cpp @@ -14,62 +14,26 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "Restore.hpp" #include -#include #include #include #include -#ifdef USE_MYSQL -#include -#endif - #include -NdbOut& operator<<(NdbOut& ndbout, const TupleS& tuple); -NdbOut& operator<<(NdbOut& ndbout, const LogEntry& logEntry); -NdbOut& operator<<(NdbOut& ndbout, const RestoreMetaData &); +#include "consumer_restore.hpp" +#include "consumer_printer.hpp" extern FilteredNdbOut err; extern FilteredNdbOut info; extern FilteredNdbOut debug; -static const char * delimiter = ";"; // Delimiter in file dump - static int ga_nodeId = 0; -static int ga_nParallelism = 1; +static int ga_nParallelism = 128; static int ga_backupId = 0; static bool ga_dont_ignore_systab_0 = false; -static myVector g_consumers; +static Vector g_consumers; -#ifdef USE_MYSQL -/** - * mysql specific stuff: - */ -static const char* ga_user = "root"; -static const char* ga_host = "localhost"; -static const char* ga_socket = "/tmp/mysql.sock"; -static const char* ga_password = ""; -static const char* ga_database = ""; -static int ga_port = 3306; -static bool use_mysql = false; -static MYSQL mysql; -#endif - - -#ifdef NDB_WIN32 -static const char* ga_backupPath = ".\\"; -#else -static const char* ga_backupPath = "./"; -#endif - -typedef struct { - void * ndb; - void * restore; - TupleS * tup; - int transaction; - int retries; -} restore_callback_t; +static const char* ga_backupPath = "." DIR_SEPARATOR; static const char* ga_connect_NDB = NULL; @@ -78,100 +42,9 @@ static const char* ga_connect_NDB = NULL; */ static bool ga_restore = false; static bool ga_print = false; - - - -class BackupConsumer { -public: - virtual bool init() { return true;} - virtual bool table(const TableS &){return true;} -#ifdef USE_MYSQL - virtual bool table(const TableS &, MYSQL* mysqlp) {return true;}; -#endif - virtual void tuple(const TupleS &){} - virtual void tupleAsynch(const TupleS &, restore_callback_t * callback) {}; - // virtual bool asynchErrorHandler(NdbConnection * trans){return true;}; - virtual void asynchExitHandler(){}; - virtual void endOfTuples(){} - virtual void logEntry(const LogEntry &){} - virtual void endOfLogEntrys(){} -protected: - int create_table_string(const TableS & table, char * ,char *); -}; - -class BackupPrinter : public BackupConsumer -{ - NdbOut & m_ndbout; -public: - BackupPrinter(NdbOut & out = ndbout) : m_ndbout(out) - { - m_print = false; - m_print_log = false; - m_print_data = false; - m_print_meta = false; - } - - virtual bool table(const TableS &); -#ifdef USE_MYSQL - virtual bool table(const TableS &, MYSQL* mysqlp); -#endif - virtual void tuple(const TupleS &); - virtual void logEntry(const LogEntry &); - virtual void endOfTuples() {}; - virtual void endOfLogEntrys(); - virtual void tupleAsynch(const TupleS &, restore_callback_t * callback); - bool m_print; - bool m_print_log; - bool m_print_data; - bool m_print_meta; - Uint32 m_logCount; - Uint32 m_dataCount; - -}; - -class BackupRestore : public BackupConsumer -{ -public: - BackupRestore() - { - m_ndb = 0; - m_logCount = m_dataCount = 0; - m_restore = false; - m_restore_meta = false; - } - - virtual ~BackupRestore(); - - virtual bool init(); - virtual bool table(const TableS &); -#ifdef USE_MYSQL - virtual bool table(const TableS &, MYSQL* mysqlp); -#endif - virtual void tuple(const TupleS &); - virtual void tupleAsynch(const TupleS &, restore_callback_t * callback); - virtual void asynchExitHandler(); - virtual void endOfTuples(); - virtual void logEntry(const LogEntry &); - virtual void endOfLogEntrys(); - void connectToMysql(); - Ndb * m_ndb; - bool m_restore; - bool m_restore_meta; - Uint32 m_logCount; - Uint32 m_dataCount; -}; bool readArguments(const int argc, const char** argv) { - BackupPrinter* printer = new BackupPrinter(); - if (printer == NULL) - return false; - BackupRestore* restore = new BackupRestore(); - if (restore == NULL) - { - delete printer; - return false; - } int _print = 0; int _print_meta = 0; @@ -234,10 +107,18 @@ readArguments(const int argc, const char** argv) ga_nParallelism < 1 || ga_nParallelism >1024) { - arg_printusage(args, num_args, argv[0], "\n"); + return false; + } + + BackupPrinter* printer = new BackupPrinter(); + if (printer == NULL) + return false; + + BackupRestore* restore = new BackupRestore(ga_nParallelism); + if (restore == NULL) + { delete printer; - delete restore; return false; } @@ -280,11 +161,11 @@ readArguments(const int argc, const char** argv) } { - BackupConsumer * c = printer; + BackupConsumer * c = printer; g_consumers.push_back(c); } { - BackupConsumer * c = restore; + BackupConsumer * c = restore; g_consumers.push_back(c); } // Set backup file path @@ -292,20 +173,6 @@ readArguments(const int argc, const char** argv) { ga_backupPath = argv[optind]; } -#ifdef USE_MYSQL - if(use_mysql) { - ga_dont_ignore_systab_0 = false; - ga_database = ""; //not used yet. pethaps later if we want to - // restore meta data in an existing mysql database, - // and not just restore it to the same database - // as when the backup was taken. - // If implementing this, then the - // tupleAsynch must also be changed so that the - // table data is restored to the correct table. - // also, mysql_select_db must be set properly (ie., - // ignored in codw below) - } -#endif return true; } @@ -314,15 +181,12 @@ readArguments(const int argc, const char** argv) void clearConsumers() { - for(int i = 0; ituple_free(); +} int main(int argc, const char** argv) @@ -341,6 +211,12 @@ main(int argc, const char** argv) return -1; } + if (ga_connect_NDB != NULL) + { + // Use connection string + Ndb::setConnectString(ga_connect_NDB); + } + /** * we must always load meta data, even if we will only print it to stdout */ @@ -361,7 +237,7 @@ main(int argc, const char** argv) return -1; } - if (res == -3) + if (metaData.getNoOfTables() == 0) { ndbout_c("Restore: The backup contains no tables "); return -1; @@ -375,7 +251,7 @@ main(int argc, const char** argv) } - for(int i = 0; iinit()) { @@ -389,36 +265,22 @@ main(int argc, const char** argv) { if (checkSysTable(metaData[i]->getTableName())) { - for(int j = 0; jtable(* metaData[i], &mysql)) - { - ndbout_c("Restore: Failed to restore table: %s. " - "Exiting...", - metaData[i]->getTableName()); - return -11; - } - } else -#endif - if (!g_consumers[j]->table(* metaData[i])) - { - ndbout_c("Restore: Failed to restore table: %s. " - "Exiting...", - metaData[i]->getTableName()); - return -11; - } - + for(Uint32 j= 0; j < g_consumers.size(); j++) + if (!g_consumers[j]->table(* metaData[i])) + { + ndbout_c("Restore: Failed to restore table: %s. " + "Exiting...", + metaData[i]->getTableName()); + return -11; + } } } - - if (ga_restore || ga_print) { if (ga_restore) { - RestoreDataIterator dataIter(metaData); + RestoreDataIterator dataIter(metaData, &free_data_callback); // Read data file header if (!dataIter.readHeader()) @@ -428,19 +290,15 @@ main(int argc, const char** argv) } - while (dataIter.readFragmentHeader(res)) + while (dataIter.readFragmentHeader(res= 0)) { - const TupleS* tuple = 0; - while ((tuple = dataIter.getNextTuple(res)) != NULL) + const TupleS* tuple; + while ((tuple = dataIter.getNextTuple(res= 1)) != 0) { if (checkSysTable(tuple->getTable()->getTableName())) - { - for(int i = 0; itupleAsynch(* tuple, 0); - } - } - } while (tuple != NULL); + for(Uint32 i= 0; i < g_consumers.size(); i++) + g_consumers[i]->tuple(* tuple); + } // while (tuple != NULL); if (res < 0) { @@ -457,44 +315,37 @@ main(int argc, const char** argv) if (res < 0) { - ndbout_c("Restore: An error occured while restoring data. " - "Exiting..."); + err << "Restore: An error occured while restoring data. Exiting... res=" << res << endl; return -1; } dataIter.validateFooter(); //not implemented - for (int i = 0; iendOfTuples(); RestoreLogIterator logIter(metaData); if (!logIter.readHeader()) { - ndbout << "Failed to read header of data file. Exiting..."; + err << "Failed to read header of data file. Exiting..." << endl; return -1; } - /** - * I have not touched the part below : -johan 040218 - * except fixing return values. - */ const LogEntry * logEntry = 0; - while ((logEntry = logIter.getNextLogEntry(res))) + while ((logEntry = logIter.getNextLogEntry(res= 0)) != 0) { if (checkSysTable(logEntry->m_table->getTableName())) - { - for(int i = 0; ilogEntry(* logEntry); - } } if (res < 0) { - ndbout_c("Restore: An restoring the data log" - "Exiting..."); + err << "Restore: An restoring the data log. Exiting... res=" << res << endl; return -1; } logIter.validateFooter(); //not implemented - for (int i = 0; iendOfLogEntrys(); } } @@ -502,1033 +353,3 @@ main(int argc, const char** argv) return 1; } // main -NdbOut & -operator<<(NdbOut& ndbout, const AttributeS& attr){ - const AttributeData & data = attr.Data; - const AttributeDesc & desc = * attr.Desc; - - if (data.null) - { - ndbout << ""; - return ndbout; - } - - if (desc.arraySize > 1) - ndbout << "[ "; - for (Uint32 j = 0; j < desc.arraySize; j++) - { - // Print strings without spaces, - // (but ndbout char does not work as expected, see below) - switch (desc.type) - { - case Signed: - switch (desc.size) - { - case 8: - ndbout << (short)data.int8_value[j]; - break; - case 16: - ndbout << data.int16_value[j]; - break; - case 32: - ndbout << data.int32_value[j]; - break; - case 64: - ndbout << data.int64_value[j]; - break; - case 128: - ndbout << "Signed sz = 128 - this is something wrong??" << endl; - break; - default: - // Unknown, error - break; - } // switch size - break; - case UnSigned: - switch (desc.size) - { - case 8: - ndbout << (short)data.u_int8_value[j]; - break; - case 16: - ndbout << data.u_int16_value[j]; - break; - case 32: - ndbout << data.u_int32_value[j]; - break; - case 64: - ndbout << data.u_int64_value[j]; - break; - case 128: - ndbout << "UnSigned sz = 128 - this is something wrong??" << endl; - break; - default: - // Unknown, error - break; - } // switch size - break; - case String: - if (desc.size == 8){ - NdbDictionary::Column::Type type = desc.m_table->m_dictTable->getColumn(desc.attrId)->getType(); - if(type == NdbDictionary::Column::Varchar){ - short len = ntohs(data.u_int16_value[0]); - ndbout.print("%.*s", len, (data.string_value+2)); - } else { - ndbout << data.string_value; - } - } // if - else - { - ndbout << "String sz != 8 - this is something wrong??" << endl; - } - j = desc.arraySize; - break; - case Float: - // Not yet supported to print float - ndbout << "float"; - break; - default: - ndbout << "Not defined Attr Type"; - } // switch AttrType - ndbout << " "; - } // for ArraySize - if (desc.arraySize > 1) - { - ndbout << "]"; - } - return ndbout; -} - -// Print tuple data -NdbOut& -operator<<(NdbOut& ndbout, const TupleS& tuple) -{ - ndbout << tuple.getTable()->getTableName() << "; "; - for (int i = 0; i < tuple.getNoOfAttributes(); i++) - { - const AttributeS * attr = tuple[i]; - debug << i << " " << attr->Desc->name; - ndbout << (* attr); - - if (i != (tuple.getNoOfAttributes() - 1)) - ndbout << delimiter << " "; - } // for - return ndbout; -} - -// Print tuple data -NdbOut& -operator<<(NdbOut& ndbout, const LogEntry& logE) -{ - switch(logE.m_type) - { - case LogEntry::LE_INSERT: - ndbout << "INSERT " << logE.m_table->getTableName() << " "; - break; - case LogEntry::LE_DELETE: - ndbout << "DELETE " << logE.m_table->getTableName() << " "; - break; - case LogEntry::LE_UPDATE: - ndbout << "UPDATE " << logE.m_table->getTableName() << " "; - break; - default: - ndbout << "Unknown log entry type (not insert, delete or update)" ; - } - - for (int i = 0; i < logE.m_values.size();i++) - { - const AttributeS * attr = logE.m_values[i]; - ndbout << attr->Desc->name << "="; - ndbout << (* attr); - if (i < (logE.m_values.size() - 1)) - ndbout << ", "; - } - return ndbout; -} - - -NdbOut & -operator<<(NdbOut& ndbout, const TableS & table){ - ndbout << endl << "Table: " << table.getTableName() << endl; - for (int j = 0; j < table.getNoOfAttributes(); j++) - { - const AttributeDesc * desc = table[j]; - ndbout << desc->name << ": "; - NdbDictionary::Column::Type type = table.m_dictTable->getColumn(desc->attrId)->getType(); - switch(type){ - case NdbDictionary::Column::Int: - ndbout << "Int "; - break; - case NdbDictionary::Column::Unsigned: - ndbout << "Unsigned "; - break; - case NdbDictionary::Column::Float: - ndbout << "Float "; - break; - case NdbDictionary::Column::Decimal: - ndbout << "Decimal "; - break; - case NdbDictionary::Column::Char: - ndbout << "Char "; - break; - case NdbDictionary::Column::Varchar: - ndbout << "Varchar "; - break; - case NdbDictionary::Column::Binary: - ndbout << "Binary "; - break; - case NdbDictionary::Column::Varbinary: - ndbout << "Varbinary "; - break; - case NdbDictionary::Column::Bigint: - ndbout << "Bigint "; - break; - case NdbDictionary::Column::Bigunsigned: - ndbout << "Bigunsigned "; - break; - case NdbDictionary::Column::Double: - ndbout << "Double "; - break; - case NdbDictionary::Column::Datetime: - ndbout << "Datetime "; - break; - case NdbDictionary::Column::Timespec: - ndbout << "Timespec "; - break; - case NdbDictionary::Column::Undefined: - ndbout << "Undefined "; - break; - default: - ndbout << "Unknown(" << type << ")"; - } - ndbout << " key: " << desc->key; - ndbout << " array: " << desc->arraySize; - ndbout << " size: " << desc->size << endl; - } // for - return ndbout; -} - - -#if 0 -/***************************************** - * - * Callback function for asynchronous transactions - * - * Idea for error handling: Transaction objects have to be stored globally when - * they are prepared. - * In the callback function if the transaction: - * succeeded: delete the object from global storage - * failed but can be retried: execute the object that is in global storage - * failed but fatal: delete the object from global storage - * - ******************************************/ -static void restoreCallback(int result, // Result for transaction - NdbConnection *object, // Transaction object - void *anything) // Not used -{ - static Uint32 counter = 0; - - - debug << "restoreCallback function called " << counter << " time(s)" << endl; - - ++counter; - - if (result == -1) - { - ndbout << " restoreCallback (" << counter; - if ((counter % 10) == 1) - { - ndbout << "st"; - } // if - else if ((counter % 10) == 2) - { - ndbout << "nd"; - } // else if - else if ((counter % 10 ) ==3) - { - ndbout << "rd"; - } // else if - else - { - ndbout << "th"; - } // else - err << " time: error detected " << object->getNdbError() << endl; - } // if - -} // restoreCallback -#endif - - - -bool -BackupPrinter::table(const TableS & tab) -{ - if (m_print || m_print_meta) - { - m_ndbout << tab; - ndbout_c("Successfully printed table: %s", tab.m_dictTable->getName()); - } - return true; -} - -#ifdef USE_MYSQL -bool -BackupPrinter::table(const TableS & tab, MYSQL * mysql) -{ - if (m_print || m_print_meta) - { - - char tmpTabName[MAX_TAB_NAME_SIZE*2]; - sprintf(tmpTabName, "%s", tab.getTableName()); - char * database = strtok(tmpTabName, "/"); - char * schema = strtok( NULL , "/"); - char * tableName = strtok( NULL , "/"); - - /** - * this means that the user did not specify schema - * and it is a v2x backup - */ - if(database == NULL) - return false; - if(schema == NULL) - return false; - if(tableName==NULL) - tableName = schema; - - char stmtCreateDB[255]; - - sprintf(stmtCreateDB,"CREATE DATABASE %s", database); - ndbout_c("%s", stmtCreateDB); - - - char buf [2048]; - create_table_string(tab, tableName, buf); - ndbout_c("%s", buf); - - ndbout_c("Successfully printed table: %s", tab.m_dictTable->getName()); - } - return true; -} - -#endif - -void -BackupPrinter::tuple(const TupleS & tup) -{ - if (m_print || m_print_data) - m_ndbout << tup << endl; -} - -void -BackupPrinter::logEntry(const LogEntry & logE) -{ - if (m_print || m_print_log) - m_ndbout << logE << endl; - m_logCount++; -} - -bool -BackupRestore::init() -{ - - if (!m_restore && !m_restore_meta) - return true; - - if (ga_connect_NDB != NULL) - { - // Use connection string - Ndb::setConnectString(ga_connect_NDB); - } - - m_ndb = new Ndb(); - - if (m_ndb == NULL) - return false; - - // Turn off table name completion - m_ndb->useFullyQualifiedNames(false); - - m_ndb->init(1024); - if (m_ndb->waitUntilReady(30) != 0) - { - ndbout << "Failed to connect to ndb!!" << endl; - delete m_ndb; - return false; - } - ndbout << "Connected to ndb!!" << endl; - -#if USE_MYSQL - if(use_mysql) - { - if ( mysql_thread_safe() == 0 ) - { - ndbout << "Not thread safe mysql library..." << endl; - exit(-1); - } - - ndbout << "Connecting to MySQL..." <name << ": "; - pos += sprintf(buf+pos, "%s%s", desc->name," "); - NdbDictionary::Column::Type type = table.m_dictTable->getColumn(desc->attrId)->getType(); - switch(type){ - case NdbDictionary::Column::Int: - pos += sprintf(buf+pos, "%s", "int"); - break; - case NdbDictionary::Column::Unsigned: - pos += sprintf(buf+pos, "%s", "int unsigned"); - break; - case NdbDictionary::Column::Float: - pos += sprintf(buf+pos, "%s", "float"); - break; - case NdbDictionary::Column::Decimal: - pos += sprintf(buf+pos, "%s", "decimal"); - break; - case NdbDictionary::Column::Char: - pos += sprintf(buf+pos, "%s", "char"); - break; - case NdbDictionary::Column::Varchar: - pos += sprintf(buf+pos, "%s", "varchar"); - break; - case NdbDictionary::Column::Binary: - pos += sprintf(buf+pos, "%s", "binary"); - break; - case NdbDictionary::Column::Varbinary: - pos += sprintf(buf+pos, "%s", "varchar binary"); - break; - case NdbDictionary::Column::Bigint: - pos += sprintf(buf+pos, "%s", "bigint"); - break; - case NdbDictionary::Column::Bigunsigned: - pos += sprintf(buf+pos, "%s", "bigint unsigned"); - break; - case NdbDictionary::Column::Double: - pos += sprintf(buf+pos, "%s", "double"); - break; - case NdbDictionary::Column::Datetime: - pos += sprintf(buf+pos, "%s", "datetime"); - break; - case NdbDictionary::Column::Timespec: - pos += sprintf(buf+pos, "%s", "time"); - break; - case NdbDictionary::Column::Undefined: - // pos += sprintf(buf+pos, "%s", "varchar binary"); - return -1; - break; - default: - //pos += sprintf(buf+pos, "%s", "varchar binary"); - return -1; - } - if (desc->arraySize > 1) { - int attrSize = desc->arraySize; - pos += sprintf(buf+pos, "%s%u%s", - "(", - attrSize, - ")"); - } - if (table.m_dictTable->getColumn(desc->attrId)->getPrimaryKey()) { - pos += sprintf(buf+pos, "%s", " not null"); - pos2 += sprintf(buf2+pos2, "%s%s", desc->name, ","); - } - pos += sprintf(buf+pos, "%s", ","); - } // for - pos2--; // remove trailing comma - pos2 += sprintf(buf2+pos2, "%s", ")"); - // pos--; // remove trailing comma - - pos += sprintf(buf+pos, "%s", buf2); - pos += sprintf(buf+pos, "%s", ") type=ndbcluster"); - return 0; -} - - - -bool -BackupRestore::table(const TableS & table){ - if (!m_restore_meta) - { - return true; - } - NdbDictionary::Dictionary* dict = m_ndb->getDictionary(); - if (dict->createTable(*table.m_dictTable) == -1) - { - err << "Create table " << table.getTableName() << " failed: " - << dict->getNdbError() << endl; - return false; - } - info << "Successfully restored table " << table.getTableName()<< endl ; - return true; -} - - - -/* - * callback : This is called when the transaction is polled - * - * (This function must have three arguments: - * - The result of the transaction, - * - The NdbConnection object, and - * - A pointer to an arbitrary object.) - */ - -static void -callback(int result, NdbConnection* trans, void* aObject) -{ - restore_callback_t * cbData = (restore_callback_t *)aObject; - if (result<0) - { - /** - * Error. temporary or permanent? - */ - if (asynchErrorHandler(trans, (Ndb*)cbData->ndb)) - { - ((Ndb*)cbData->ndb)->closeTransaction(asynchTrans[cbData->transaction]); - cbData->retries++; - ((BackupRestore*)cbData)->tupleAsynch( * (TupleS*)(cbData->tup), cbData); - } - else - { - ndbout_c("Restore: Failed to restore data " - "due to a unrecoverable error. Exiting..."); - delete (Ndb*)cbData->ndb; - delete cbData->tup; - delete cbData; - exit(-1); - } - } - else - { - /** - * OK! close transaction - */ - ((Ndb*)cbData->ndb)->closeTransaction(asynchTrans[cbData->transaction]); - delete cbData->tup; - delete cbData; - } -} - -static int nPreparedTransactions = 0; -void -BackupPrinter::tupleAsynch(const TupleS & tup, restore_callback_t * callback) -{ - m_dataCount++; - if (m_print || m_print_data) - m_ndbout << tup << endl; -} - -void BackupRestore::tupleAsynch(const TupleS & tup, restore_callback_t * cbData) -{ - - if (!m_restore) - { - delete &tup; - return; - } - Uint32 retries; - if (cbData!=0) - retries = cbData->retries; - else - retries = 0; - - while (retries < 10) - { - /** - * start transactions - */ - asynchTrans[nPreparedTransactions] = m_ndb->startTransaction(); - if (asynchTrans[nPreparedTransactions] == NULL) - { - if (asynchErrorHandler(asynchTrans[nPreparedTransactions], m_ndb)) - { - retries++; - continue; - } - asynchExitHandler(); - } // if - - const TableS * table = tup.getTable(); - NdbOperation * op = - asynchTrans[nPreparedTransactions]->getNdbOperation(table->getTableName()); - - if (op == NULL) - { - if (asynchErrorHandler(asynchTrans[nPreparedTransactions], m_ndb)) - { - retries++; - continue; - } - asynchExitHandler(); - } // if - - if (op->writeTuple() == -1) - { - if (asynchErrorHandler(asynchTrans[nPreparedTransactions], m_ndb)) - { - retries++; - continue; - } - asynchExitHandler(); - } // if - - Uint32 ret = 0; - for (int i = 0; i < tup.getNoOfAttributes(); i++) - { - const AttributeS * attr = tup[i]; - int size = attr->Desc->size; - int arraySize = attr->Desc->arraySize; - const KeyType key = attr->Desc->key; - char * dataPtr = attr->Data.string_value; - Uint32 length = (size * arraySize) / 8; - if (key == TupleKey) - { - ret = op->equal(i, dataPtr, length); - if (ret<0) - { - ndbout_c("Column: %d type %d",i, - tup.getTable()->m_dictTable->getColumn(i)->getType()); - - if (asynchErrorHandler(asynchTrans[nPreparedTransactions],m_ndb)) - { - retries++; - continue; - } - asynchExitHandler(); - } - } - } - - for (int i = 0; i < tup.getNoOfAttributes(); i++) - { - const AttributeS * attr = tup[i]; - int size = attr->Desc->size; - int arraySize = attr->Desc->arraySize; - KeyType key = attr->Desc->key; - char * dataPtr = attr->Data.string_value; - Uint32 length = (size * arraySize) / 8; - - if (key == NoKey && !attr->Data.null) - ret = op->setValue(i, dataPtr, length); - else if (key == NoKey && attr->Data.null) - ret = op->setValue(i, NULL, 0); - - if (ret<0) - { - ndbout_c("Column: %d type %d",i, - tup.getTable()->m_dictTable->getColumn(i)->getType()); - if (asynchErrorHandler(asynchTrans[nPreparedTransactions], m_ndb)) - { - retries++; - continue; - } - asynchExitHandler(); - } - } - restore_callback_t * cb; - if (cbData ==0) - { - cb = new restore_callback_t; - cb->retries = 0; - } - else - cb =cbData; - cb->ndb = m_ndb; - cb->restore = this; - cb->tup = (TupleS*)&tup; - cb->transaction = nPreparedTransactions; - - // Prepare transaction (the transaction is NOT yet sent to NDB) - asynchTrans[nPreparedTransactions]->executeAsynchPrepare(Commit, - &callback, - cb); - if (nPreparedTransactions == ga_nParallelism-1) - { - // send-poll all transactions - // close transaction is done in callback - m_ndb->sendPollNdb(3000, ga_nParallelism); - nPreparedTransactions=0; - } - else - nPreparedTransactions++; - m_dataCount++; - return; - } - ndbout_c("Unable to recover from errors. Exiting..."); - asynchExitHandler(); -} - -void BackupRestore::asynchExitHandler() -{ - if (m_ndb != NULL) - delete m_ndb; - exit(-1); -} -/** - * returns true if is recoverable, - * Error handling based on hugo - * false if it is an error that generates an abort. - */ -static -bool asynchErrorHandler(NdbConnection * trans, Ndb* ndb) -{ - - NdbError error = trans->getNdbError(); - ndb->closeTransaction(trans); - switch(error.status) - { - case NdbError::Success: - return false; - // ERROR! - break; - - case NdbError::TemporaryError: - NdbSleep_MilliSleep(10); - return true; - // RETRY - break; - - case NdbError::UnknownResult: - ndbout << error << endl; - return false; - // ERROR! - break; - - default: - case NdbError::PermanentError: - switch (error.code) - { - case 499: - case 250: - NdbSleep_MilliSleep(10); - return true; //temp errors? - default: - break; - } - //ERROR - ndbout << error << endl; - return false; - break; - } - return false; -} - - - -void -BackupRestore::tuple(const TupleS & tup) -{ - if (!m_restore) - return; - while (1) - { - NdbConnection * trans = m_ndb->startTransaction(); - if (trans == NULL) - { - // Deep shit, TODO: handle the error - ndbout << "Cannot start transaction" << endl; - exit(-1); - } // if - - const TableS * table = tup.getTable(); - NdbOperation * op = trans->getNdbOperation(table->getTableName()); - if (op == NULL) - { - ndbout << "Cannot get operation: "; - ndbout << trans->getNdbError() << endl; - exit(-1); - } // if - - // TODO: check return value and handle error - if (op->writeTuple() == -1) - { - ndbout << "writeTuple call failed: "; - ndbout << trans->getNdbError() << endl; - exit(-1); - } // if - - for (int i = 0; i < tup.getNoOfAttributes(); i++) - { - const AttributeS * attr = tup[i]; - int size = attr->Desc->size; - int arraySize = attr->Desc->arraySize; - KeyType key = attr->Desc->key; - const char * dataPtr = attr->Data.string_value; - - const Uint32 length = (size * arraySize) / 8; - if (key == TupleKey) - { - op->equal(i, dataPtr, length); - } - } - - for (int i = 0; i < tup.getNoOfAttributes(); i++) - { - const AttributeS * attr = tup[i]; - int size = attr->Desc->size; - int arraySize = attr->Desc->arraySize; - KeyType key = attr->Desc->key; - const char * dataPtr = attr->Data.string_value; - - const Uint32 length = (size * arraySize) / 8; - if (key == NoKey && !attr->Data.null) - { - op->setValue(i, dataPtr, length); - } - else if (key == NoKey && attr->Data.null) - { - op->setValue(i, NULL, 0); - } - } - int ret = trans->execute(Commit); - if (ret != 0) - { - ndbout << "execute failed: "; - ndbout << trans->getNdbError() << endl; - exit(-1); - } - m_ndb->closeTransaction(trans); - if (ret == 0) - break; - } - m_dataCount++; -} - -void -BackupRestore::endOfTuples() -{ - if (!m_restore) - return; - // Send all transactions to NDB - m_ndb->sendPreparedTransactions(0); - // Poll all transactions - m_ndb->pollNdb(3000, nPreparedTransactions); - // Close all transactions - // for (int i = 0; i < nPreparedTransactions; i++) - // m_ndb->closeTransaction(asynchTrans[i]); - nPreparedTransactions=0; -} - -void -BackupRestore::logEntry(const LogEntry & tup) -{ - if (!m_restore) - return; - - NdbConnection * trans = m_ndb->startTransaction(); - if (trans == NULL) - { - // Deep shit, TODO: handle the error - ndbout << "Cannot start transaction" << endl; - exit(-1); - } // if - - const TableS * table = tup.m_table; - NdbOperation * op = trans->getNdbOperation(table->getTableName()); - if (op == NULL) - { - ndbout << "Cannot get operation: "; - ndbout << trans->getNdbError() << endl; - exit(-1); - } // if - - int check = 0; - switch(tup.m_type) - { - case LogEntry::LE_INSERT: - check = op->insertTuple(); - break; - case LogEntry::LE_UPDATE: - check = op->updateTuple(); - break; - case LogEntry::LE_DELETE: - check = op->deleteTuple(); - break; - default: - ndbout << "Log entry has wrong operation type." - << " Exiting..."; - exit(-1); - } - - for (int i = 0; i < tup.m_values.size(); i++) - { - const AttributeS * attr = tup.m_values[i]; - int size = attr->Desc->size; - int arraySize = attr->Desc->arraySize; - KeyType key = attr->Desc->key; - const char * dataPtr = attr->Data.string_value; - - const Uint32 length = (size / 8) * arraySize; - if (key == TupleKey) - { - op->equal(attr->Desc->attrId, dataPtr, length); - } - else if (key == NoKey) - { - op->setValue(attr->Desc->attrId, dataPtr, length); - } - } - -#if 1 - trans->execute(Commit); -#else - const int ret = trans->execute(Commit); - // Both insert update and delete can fail during log running - // and it's ok - - if (ret != 0) - { - ndbout << "execute failed: "; - ndbout << trans->getNdbError() << endl; - exit(-1); - } -#endif - - m_ndb->closeTransaction(trans); - m_logCount++; -} - -void -BackupRestore::endOfLogEntrys() -{ - if (ga_restore) - { - ndbout << "Restored " << m_dataCount << " tuples and " - << m_logCount << " log entries" << endl; - } -} - -void -BackupPrinter::endOfLogEntrys() -{ - if (m_print || m_print_log) - { - ndbout << "Printed " << m_dataCount << " tuples and " - << m_logCount << " log entries" - << " to stdout." << endl; - } -} - - - - diff --git a/ndb/src/kernel/blocks/backup/restore/myVector.hpp b/ndb/src/kernel/blocks/backup/restore/myVector.hpp deleted file mode 100644 index c858999d2be..00000000000 --- a/ndb/src/kernel/blocks/backup/restore/myVector.hpp +++ /dev/null @@ -1,128 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifndef MY_VECTOR_HPP -#define MY_VECTOR_HPP - -// Template class for std::vector-like class (hopefully works in OSE) -template -class myVector -{ - - // Note that last element in array is used for end() and is always empty - int sizeIncrement; - int thisSize; - int used; - T *storage; - -public: - - // Assignment of whole vector - myVector & operator=(myVector & org) { - - // Don't copy if they point to the same address - if (!(this == &org)) { - // Check memory space - if (thisSize < org.thisSize) { - // We have to increase memory for destination - T* tmpStorage = new T[org.thisSize]; - delete[] storage; - storage = tmpStorage; - } // if - thisSize = org.thisSize; - sizeIncrement = org.sizeIncrement; - used = org.used; - for (int i = 0; i < thisSize; i++) { - storage[i] = org.storage[i]; - } // for - } // if - return *this; - } // operator= - - // Construct with size s+1 - myVector(int s = 1) : sizeIncrement(5), // sizeIncrement(s), - thisSize(s + 1), - used(0), - storage(new T[s + 1]) { } - - ~myVector() { delete[] storage; } // Destructor: deallocate memory - - T& operator[](int i) { // Return by index - if ((i < 0) || (i >= used)) { - // Index error - ndbout << "vector index out of range" << endl; - abort(); - return storage[used - 1]; - } // if - else { - return storage[i]; - } // else - } // operator[] - - const T& operator[](int i) const { // Return by index - if ((i < 0) || (i >= used)) { - // Index error - ndbout << "vector index out of range" << endl; - abort(); - return storage[used - 1]; - } // if - else { - return storage[i]; - } // else - } // operator[] - - int getSize() const { return used; } - - void push_back (T& item) { - if (used >= thisSize - 1) { - // We have to allocate new storage - int newSize = thisSize + sizeIncrement; - T* tmpStorage = new T[newSize]; - if (tmpStorage == NULL) { - // Memory allocation error! break - ndbout << "PANIC: Memory allocation error in vector" << endl; - return; - } // if - thisSize = newSize; - for (int i = 0; i < used; i++) { - tmpStorage[i] = storage[i]; - } // for - delete[] storage; - storage = tmpStorage; - } // if - - // Now push - storage[used] = item; - used++; - }; // myVector<> push_back() - - // Remove item at back - void pop_back() { - if (used > 0) { - used--; - } // if - } // pop_back() - - int size() const { return used; }; - - bool empty() const { return(used == 0); } - - void clear() { - used = 0; - } -}; - -#endif diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index a11205047e5..3b99f0d5392 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -110,7 +110,7 @@ Dbdict::execDUMP_STATE_ORD(Signal* signal) { jamEntry(); -#ifdef NDB_DEBUG +#ifdef VM_TRACE if(signal->theData[0] == 1222){ const Uint32 tab = signal->theData[1]; PrepDropTabReq* req = (PrepDropTabReq*)signal->getDataPtr(); diff --git a/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp b/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp index 5965673f25f..0ae83f68b50 100644 --- a/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp +++ b/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp @@ -72,11 +72,11 @@ static BlockInfo ALL_BLOCKS[] = { { NDBCNTR_REF, 0 , 1000, 1999 }, { QMGR_REF, 1 , 1, 999 }, { CMVMI_REF, 1 , 9000, 9999 }, - { TRIX_REF, 1 }, + { TRIX_REF, 1 , 0, 0 }, { BACKUP_REF, 1 , 10000, 10999 }, { DBUTIL_REF, 1 , 11000, 11999 }, { SUMA_REF, 1 , 13000, 13999 }, - { GREP_REF, 1 }, + { GREP_REF, 1 , 0, 0 }, { DBTUX_REF, 1 , 12000, 12999 } }; @@ -450,13 +450,7 @@ void Ndbcntr::execREAD_NODESCONF(Signal* signal) c_start.m_startPartitionedTimeout = setTimeout(c_start.m_startTime, to_2); c_start.m_startFailureTimeout = setTimeout(c_start.m_startTime, to_3); - if(getNodeInfo(cmasterNodeId).m_version < MAKE_VERSION(3,5,0)){ - /** - * Old NDB running - */ - UpgradeStartup::sendCmAppChg(* this, signal, 0); // ADD - return; - } + UpgradeStartup::sendCmAppChg(* this, signal, 0); // ADD sendCntrStartReq(signal); @@ -2543,6 +2537,15 @@ void Ndbcntr::Missra::sendNextSTTOR(Signal* signal){ void UpgradeStartup::sendCmAppChg(Ndbcntr& cntr, Signal* signal, Uint32 startLevel){ + if(cntr.getNodeInfo(cntr.cmasterNodeId).m_version >= MAKE_VERSION(3,5,0)){ + jam(); + return; + } + + /** + * Old NDB running + */ + signal->theData[0] = startLevel; signal->theData[1] = cntr.getOwnNodeId(); signal->theData[2] = 3 | ('N' << 8); diff --git a/ndb/src/kernel/blocks/suma/Makefile.am b/ndb/src/kernel/blocks/suma/Makefile.am index 5fc59083484..4dacb22af51 100644 --- a/ndb/src/kernel/blocks/suma/Makefile.am +++ b/ndb/src/kernel/blocks/suma/Makefile.am @@ -1,4 +1,4 @@ -pkglib_LIBRARIES = libsuma.a +noinst_LIBRARIES = libsuma.a libsuma_a_SOURCES = Suma.cpp SumaInit.cpp diff --git a/ndb/src/kernel/error/ErrorReporter.cpp b/ndb/src/kernel/error/ErrorReporter.cpp index 56627cba46f..20a9dd8a993 100644 --- a/ndb/src/kernel/error/ErrorReporter.cpp +++ b/ndb/src/kernel/error/ErrorReporter.cpp @@ -40,8 +40,8 @@ const char* errorType[] = { static int WriteMessage(ErrorCategory thrdType, int thrdMessageID, const char* thrdProblemData, const char* thrdObjRef, - Uint32 thrdTheEmulatedJamIndex = 0, - Uint8 thrdTheEmulatedJam[] = 0); + Uint32 thrdTheEmulatedJamIndex, + Uint8 thrdTheEmulatedJam[]); static void dumpJam(FILE* jamStream, Uint32 thrdTheEmulatedJamIndex, @@ -157,21 +157,18 @@ ErrorReporter::handleAssert(const char* message, const char* file, int line) { char refMessage[100]; -#ifdef USE_EMULATED_JAM +#ifdef NO_EMULATED_JAM + snprintf(refMessage, 100, "file: %s lineNo: %d", + file, line); +#else const Uint32 blockNumber = theEmulatedJamBlockNumber; const char *blockName = getBlockName(blockNumber); snprintf(refMessage, 100, "%s line: %d (block: %s)", file, line, blockName); - +#endif WriteMessage(assert, ERR_ERROR_PRGERR, message, refMessage, theEmulatedJamIndex, theEmulatedJam); -#else - snprintf(refMessage, 100, "file: %s lineNo: %d", - file, line); - - WriteMessage(assert, ERR_ERROR_PRGERR, message, refMessage); -#endif NdbShutdown(NST_ErrorHandler); } @@ -199,12 +196,8 @@ ErrorReporter::handleError(ErrorCategory type, int messageID, // The value for type is not always set correctly in the calling function. // So, to correct this, we set it set it to the value corresponding to // the function that is called. -#ifdef USE_EMULATED_JAM WriteMessage(type, messageID, problemData, objRef, theEmulatedJamIndex, theEmulatedJam); -#else - WriteMessage(type, messageID, problemData, objRef); -#endif if(messageID == ERR_ERROR_INSERT){ NdbShutdown(NST_ErrorInsert); } else { @@ -212,9 +205,6 @@ ErrorReporter::handleError(ErrorCategory type, int messageID, } } -// This is the function to write the error-message, -// when the USE_EMULATED_JAM-flag is set -// during compilation. int WriteMessage(ErrorCategory thrdType, int thrdMessageID, const char* thrdProblemData, const char* thrdObjRef, @@ -302,9 +292,7 @@ WriteMessage(ErrorCategory thrdType, int thrdMessageID, // ...and "dump the jam" there. // ErrorReporter::dumpJam(jamStream); if(thrdTheEmulatedJam != 0){ -#ifdef USE_EMULATED_JAM dumpJam(jamStream, thrdTheEmulatedJamIndex, thrdTheEmulatedJam); -#endif } /* Dont print the jobBuffers until a way to copy them, @@ -325,7 +313,7 @@ void dumpJam(FILE *jamStream, Uint32 thrdTheEmulatedJamIndex, Uint8 thrdTheEmulatedJam[]) { -#ifdef USE_EMULATED_JAM +#ifndef NO_EMULATED_JAM // print header const int maxaddr = 8; fprintf(jamStream, "JAM CONTENTS up->down left->right ?=not block entry\n"); @@ -392,5 +380,5 @@ dumpJam(FILE *jamStream, } fprintf(jamStream, "\n"); fflush(jamStream); -#endif // USE_EMULATED_JAM +#endif // ifndef NO_EMULATED_JAM } diff --git a/ndb/src/kernel/error/ErrorReporter.hpp b/ndb/src/kernel/error/ErrorReporter.hpp index 20340a9602f..b43b30f1873 100644 --- a/ndb/src/kernel/error/ErrorReporter.hpp +++ b/ndb/src/kernel/error/ErrorReporter.hpp @@ -37,21 +37,13 @@ ErrorReporter::handleThreadAssert(message, __FILE__, __LINE__); } #ifdef NDEBUG - #define NDB_ASSERT(trueToContinue, message) -#define THREAD_ASSERT(trueToContinue, message) - #else - #define NDB_ASSERT(trueToContinue, message) \ if ( !(trueToContinue) ) { \ ErrorReporter::handleAssert(message, __FILE__, __LINE__); } - -#define THREAD_ASSERT(trueToContinue, message) \ - if ( !(trueToContinue) ) { \ - ErrorReporter::handleThreadAssert(message, __FILE__, __LINE__); } - #endif + // Description: // This macro is used to report programming errors. // Parameters: diff --git a/ndb/src/kernel/error/Makefile.am b/ndb/src/kernel/error/Makefile.am index 5ddf050caaa..4514d2d105c 100644 --- a/ndb/src/kernel/error/Makefile.am +++ b/ndb/src/kernel/error/Makefile.am @@ -1,4 +1,4 @@ -pkglib_LIBRARIES = liberror.a +noinst_LIBRARIES = liberror.a liberror_a_SOURCES = TimeModule.cpp \ ErrorReporter.cpp \ diff --git a/ndb/src/kernel/ndb-main/Makefile.am b/ndb/src/kernel/ndb-main/Makefile.am deleted file mode 100644 index b41c6e948ea..00000000000 --- a/ndb/src/kernel/ndb-main/Makefile.am +++ /dev/null @@ -1,57 +0,0 @@ - -ndbbindir_root = $(prefix) -ndbbindir = $(ndbbindir_root)/ndb/bin -ndbbin_PROGRAMS = ndb - -ndb_SOURCES = Main.cpp SimBlockList.cpp - -include $(top_srcdir)/ndb/config/common.mk.am -include $(top_srcdir)/ndb/config/type_kernel.mk.am -INCLUDES += \ - -I../blocks/cmvmi \ - -I../blocks/dbacc \ - -I../blocks/dbdict \ - -I../blocks/dbdih \ - -I../blocks/dblqh \ - -I../blocks/dbtc \ - -I../blocks/dbtup \ - -I../blocks/ndbfs \ - -I../blocks/ndbcntr \ - -I../blocks/qmgr \ - -I../blocks/trix \ - -I../blocks/backup \ - -I../blocks/dbutil \ - -I../blocks/suma \ - -I../blocks/grep \ - -I../blocks/dbtux - -LDADD += \ - ../blocks/cmvmi/libcmvmi.a \ - ../blocks/dbacc/libdbacc.a \ - ../blocks/dbdict/libdbdict.a \ - ../blocks/dbdih/libdbdih.a \ - ../blocks/dblqh/libdblqh.a \ - ../blocks/dbtc/libdbtc.a \ - ../blocks/dbtup/libdbtup.a \ - ../blocks/ndbfs/libndbfs.a \ - ../blocks/ndbcntr/libndbcntr.a \ - ../blocks/qmgr/libqmgr.a \ - ../blocks/trix/libtrix.a \ - ../blocks/backup/libbackup.a \ - ../blocks/dbutil/libdbutil.a \ - ../blocks/suma/libsuma.a \ - ../blocks/grep/libgrep.a \ - ../blocks/dbtux/libdbtux.a \ - ../vm/libkernel.a \ - ../error/liberror.a \ - $(top_srcdir)/ndb/src/common/transporter/.libs/libtransporter.a \ - $(top_srcdir)/ndb/src/common/debugger/.libs/libtrace.a \ - $(top_srcdir)/ndb/src/common/debugger/signaldata/.libs/libsignaldataprint.a \ - $(top_srcdir)/ndb/src/common/logger/.libs/liblogger.a \ - $(top_srcdir)/ndb/src/common/mgmcommon/.libs/libmgmsrvcommon.a \ - $(top_srcdir)/ndb/src/mgmapi/.libs/libmgmapi.a \ - $(top_srcdir)/ndb/src/common/portlib/unix/.libs/libportlib.a \ - $(top_srcdir)/ndb/src/common/util/.libs/libgeneral.a - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/ndb/src/kernel/ndb-main/Makefile_old b/ndb/src/kernel/ndb-main/Makefile_old deleted file mode 100644 index 08fc125cb00..00000000000 --- a/ndb/src/kernel/ndb-main/Makefile_old +++ /dev/null @@ -1,42 +0,0 @@ -include .defs.mk - -TYPE := kernel - -BIN_TARGET := ndb -BIN_TARGET_ARCHIVES := mgmapi \ - cmvmi dbacc dbdict dbdih dblqh dbtc \ - dbtup ndbfs ndbcntr qmgr trix backup dbutil suma grep dbtux \ - transporter \ - kernel \ - error \ - trace \ - signaldataprint \ - mgmsrvcommon mgmapi \ - portlib \ - logger \ - general - -# Source files of non-templated classes (.cpp files) -SOURCES = \ - Main.cpp \ - SimBlockList.cpp - -CCFLAGS_LOC = -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/cmvmi) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/dbacc) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/dbdict) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/dbdih) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/dblqh) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/dbtc) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/dbtup) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/ndbfs) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/missra) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/ndbcntr) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/qmgr) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/trix) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/backup) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/dbutil) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/suma) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/grep) \ - -I$(call fixpath,$(NDB_TOP)/src/kernel/blocks/dbtux) - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp index 0d6d3f55acb..b615e41eb65 100644 --- a/ndb/src/kernel/vm/Emulator.cpp +++ b/ndb/src/kernel/vm/Emulator.cpp @@ -43,11 +43,11 @@ extern "C" { * Declare the global variables */ -#ifdef USE_EMULATED_JAM - Uint8 theEmulatedJam[EMULATED_JAM_SIZE * 4]; - Uint32 theEmulatedJamIndex = 0; - Uint32 theEmulatedJamBlockNumber = 0; -#endif // USE_EMULATED_JAM +#ifndef NO_EMULATED_JAM +Uint8 theEmulatedJam[EMULATED_JAM_SIZE * 4]; +Uint32 theEmulatedJamIndex = 0; +Uint32 theEmulatedJamBlockNumber = 0; +#endif GlobalData globalData; diff --git a/ndb/src/kernel/vm/Emulator.hpp b/ndb/src/kernel/vm/Emulator.hpp index ba533eb873d..8c4504b9ba7 100644 --- a/ndb/src/kernel/vm/Emulator.hpp +++ b/ndb/src/kernel/vm/Emulator.hpp @@ -36,15 +36,18 @@ extern struct GlobalData globalData; extern class SignalLoggerManager globalSignalLoggers; #endif -#ifdef USE_EMULATED_JAM -#define EMULATED_JAM_SIZE 1024 -#define JAM_MASK ((EMULATED_JAM_SIZE * 4) - 1) +#ifndef NO_EMULATED_JAM + #define EMULATED_JAM_SIZE 1024 + #define JAM_MASK ((EMULATED_JAM_SIZE * 4) - 1) -extern Uint8 theEmulatedJam[]; -extern Uint32 theEmulatedJamIndex; -// last block entry, used in dumpJam() if jam contains no block entries -extern Uint32 theEmulatedJamBlockNumber; -#endif // USE_EMULATED_JAM + extern Uint8 theEmulatedJam[]; + extern Uint32 theEmulatedJamIndex; + // last block entry, used in dumpJam() if jam contains no block entries + extern Uint32 theEmulatedJamBlockNumber; +#else + const Uint8 theEmulatedJam[]=0; + const Uint32 theEmulatedJamIndex=0; +#endif struct EmulatorData { class Configuration * theConfiguration; diff --git a/ndb/src/kernel/vm/Makefile.am b/ndb/src/kernel/vm/Makefile.am index c26e6483eca..4e9dbe36c78 100644 --- a/ndb/src/kernel/vm/Makefile.am +++ b/ndb/src/kernel/vm/Makefile.am @@ -3,7 +3,7 @@ #DIRS += testLongSig #endif -pkglib_LIBRARIES = libkernel.a +noinst_LIBRARIES = libkernel.a libkernel_a_SOURCES = \ SimulatedBlock.cpp \ diff --git a/ndb/src/kernel/vm/pc.hpp b/ndb/src/kernel/vm/pc.hpp index 849799a47f3..bc74adfc8f6 100644 --- a/ndb/src/kernel/vm/pc.hpp +++ b/ndb/src/kernel/vm/pc.hpp @@ -22,8 +22,14 @@ #include #include -#ifdef USE_EMULATED_JAM +#ifdef NO_EMULATED_JAM +#define jam() +#define jamLine(line) +#define jamEntry() +#define jamEntryLine(line) + +#else #ifdef NDB_WIN32 #define jam() { \ @@ -72,11 +78,6 @@ #endif -#else -#define jam() -#define jamLine(line) -#define jamEntry() -#define jamEntryLine(line) #endif #ifndef NDB_OPT #define ptrCheck(ptr, limit, rec) if (ptr.i < (limit)) ptr.p = &rec[ptr.i]; else ptr.p = NULL @@ -184,7 +185,7 @@ * * NOTE these may only be used within blocks */ -#if defined VM_TRACE || defined NDB_DEBUG +#if defined VM_TRACE #define ndbassert(check) \ if((check)){ \ } else { \ diff --git a/ndb/src/mgmapi/Makefile.am b/ndb/src/mgmapi/Makefile.am index e67d88b3841..e4fa1d449c6 100644 --- a/ndb/src/mgmapi/Makefile.am +++ b/ndb/src/mgmapi/Makefile.am @@ -1,10 +1,7 @@ -noinst_LTLIBRARIES = libmgmapi.la libMGM_API.la +noinst_LTLIBRARIES = libmgmapi.la -libmgmapi_la_SOURCES_loc = mgmapi.cpp mgmapi_configuration.cpp - -libmgmapi_la_SOURCES = $(libmgmapi_la_SOURCES_loc) -libMGM_API_la_SOURCES = $(libmgmapi_la_SOURCES_loc) +libmgmapi_la_SOURCES = mgmapi.cpp mgmapi_configuration.cpp INCLUDES_LOC = -I$(top_srcdir)/ndb/include/mgmapi -I$(top_srcdir)/ndb/src/common/mgmcommon DEFS_LOC = -DNO_DEBUG_MESSAGES @@ -12,9 +9,5 @@ DEFS_LOC = -DNO_DEBUG_MESSAGES include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_util.mk.am -libMGM_API_la_LIBADD = \ - $(top_srcdir)/ndb/src/common/portlib/unix/libportlib.la \ - $(top_srcdir)/ndb/src/common/util/libgeneral.la - # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/ndb/src/mgmclient/Makefile.am b/ndb/src/mgmclient/Makefile.am index 56c7c050558..f3eaaaa68bd 100644 --- a/ndb/src/mgmclient/Makefile.am +++ b/ndb/src/mgmclient/Makefile.am @@ -1,7 +1,7 @@ -ndbbin_PROGRAMS = mgmtclient +ndbtools_PROGRAMS = ndb_mgm -mgmtclient_SOURCES = \ +ndb_mgm_SOURCES = \ main.cpp \ CommandInterpreter.cpp \ CpcClient.cpp @@ -11,9 +11,11 @@ include $(top_srcdir)/ndb/config/type_ndbapi.mk.am INCLUDES += -I$(top_srcdir)/ndb/include/mgmapi -I$(top_srcdir)/ndb/src/common/mgmcommon -LDADD_LOC = $(top_srcdir)/ndb/src/.libs/libndbclient.a \ - $(top_srcdir)/ndb/src/common/editline/libeditline.a \ +LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la \ + $(top_builddir)/ndb/src/common/editline/libeditline.a \ @TERMCAP_LIB@ +ndb_mgm_LDFLAGS = @ndb_bin_am_ldflags@ + # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/ndb/src/mgmsrv/CommandInterpreter.cpp b/ndb/src/mgmsrv/CommandInterpreter.cpp index cda613a5ef2..004fc463b70 100644 --- a/ndb/src/mgmsrv/CommandInterpreter.cpp +++ b/ndb/src/mgmsrv/CommandInterpreter.cpp @@ -27,7 +27,6 @@ #include #include "ConfigInfo.hpp" -extern "C" #include diff --git a/ndb/src/mgmsrv/Makefile.am b/ndb/src/mgmsrv/Makefile.am index 56e8b2ee628..fc493fe10c7 100644 --- a/ndb/src/mgmsrv/Makefile.am +++ b/ndb/src/mgmsrv/Makefile.am @@ -1,7 +1,7 @@ -ndbbin_PROGRAMS = mgmtsrvr +ndbbin_PROGRAMS = ndb_mgmd -mgmtsrvr_SOURCES = \ +ndb_mgmd_SOURCES = \ MgmtSrvr.cpp \ MgmtSrvrGeneralSignalHandling.cpp \ main.cpp \ @@ -17,12 +17,14 @@ INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi \ -I$(top_srcdir)/ndb/src/mgmapi \ -I$(top_srcdir)/ndb/src/common/mgmcommon -LDADD_LOC = $(top_srcdir)/ndb/src/.libs/libndbclient.a \ - $(top_srcdir)/ndb/src/common/editline/libeditline.a \ +LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la \ + $(top_builddir)/ndb/src/common/editline/libeditline.a \ @TERMCAP_LIB@ include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_ndbapi.mk.am +ndb_mgmd_LDFLAGS = @ndb_bin_am_ldflags@ + # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/ndb/src/ndbapi/Makefile.am b/ndb/src/ndbapi/Makefile.am index 13b6ad59229..f1a6dc366ea 100644 --- a/ndb/src/ndbapi/Makefile.am +++ b/ndb/src/ndbapi/Makefile.am @@ -1,12 +1,13 @@ #SUBDIRS = signal-sender -noinst_LTLIBRARIES = libndbapi.la libNDB_API.la +noinst_LTLIBRARIES = libndbapi.la -libndbapi_la_SOURCES_loc = \ +libndbapi_la_SOURCES = \ TransporterFacade.cpp \ ClusterMgr.cpp \ Ndb.cpp \ - NdbPoolImpl.cpp NdbPool.cpp \ + NdbPoolImpl.cpp \ + NdbPool.cpp \ Ndblist.cpp \ Ndbif.cpp \ Ndbinit.cpp \ @@ -28,29 +29,19 @@ libndbapi_la_SOURCES_loc = \ NdbEventOperationImpl.cpp \ NdbApiSignal.cpp \ NdbRecAttr.cpp \ - NdbSchemaCon.cpp \ - NdbSchemaOp.cpp \ NdbUtil.cpp \ NdbReceiver.cpp \ - NdbDictionary.cpp NdbDictionaryImpl.cpp DictCache.cpp - -libndbapi_la_SOURCES = $(libndbapi_la_SOURCES_loc) -libNDB_API_la_SOURCES = $(libndbapi_la_SOURCES_loc) + NdbDictionary.cpp \ + NdbDictionaryImpl.cpp \ + DictCache.cpp INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi +# Ndbapi cannot handle -O3 +NDB_CXXFLAGS_RELEASE_LOC = -O2 + include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_ndbapi.mk.am -libNDB_API_la_LIBADD = \ - $(top_srcdir)/ndb/src/common/transporter/libtransporter.la \ - $(top_srcdir)/ndb/src/common/debugger/libtrace.la \ - $(top_srcdir)/ndb/src/common/debugger/signaldata/libsignaldataprint.la \ - $(top_srcdir)/ndb/src/common/mgmcommon/libmgmsrvcommon.la \ - $(top_srcdir)/ndb/src/mgmapi/libMGM_API.la \ - $(top_srcdir)/ndb/src/common/portlib/unix/libportlib.la \ - $(top_srcdir)/ndb/src/common/logger/liblogger.la \ - $(top_srcdir)/ndb/src/common/util/libgeneral.la - # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp index 89ed801bec5..55b6d6d8f99 100644 --- a/ndb/src/ndbapi/NdbDictionary.cpp +++ b/ndb/src/ndbapi/NdbDictionary.cpp @@ -103,6 +103,11 @@ NdbDictionary::Column::getLength() const{ return m_impl.m_length; } +int +NdbDictionary::Column::getSize() const{ + return m_impl.m_attrSize; +} + void NdbDictionary::Column::setNullable(bool val){ m_impl.m_nullable = val; @@ -797,3 +802,74 @@ const struct NdbError & NdbDictionary::Dictionary::getNdbError() const { return m_impl.getNdbError(); } + +NdbOut& operator <<(NdbOut& ndbout, const NdbDictionary::Column::Type type) +{ + switch(type){ + case NdbDictionary::Column::Bigunsigned: + ndbout << "Bigunsigned"; + break; + case NdbDictionary::Column::Unsigned: + ndbout << "Unsigned"; + break; + case NdbDictionary::Column::Smallunsigned: + ndbout << "Smallunsigned"; + break; + case NdbDictionary::Column::Tinyunsigned: + ndbout << "Tinyunsigned"; + break; + case NdbDictionary::Column::Bigint: + ndbout << "Bigint"; + break; + case NdbDictionary::Column::Int: + ndbout << "Int"; + break; + case NdbDictionary::Column::Smallint: + ndbout << "Smallint"; + break; + case NdbDictionary::Column::Tinyint: + ndbout << "Tinyint"; + break; + case NdbDictionary::Column::Char: + ndbout << "Char"; + break; + case NdbDictionary::Column::Varchar: + ndbout << "Varchar"; + break; + case NdbDictionary::Column::Float: + ndbout << "Float"; + break; + case NdbDictionary::Column::Double: + ndbout << "Double"; + break; + case NdbDictionary::Column::Mediumint: + ndbout << "Mediumint"; + break; + case NdbDictionary::Column::Mediumunsigned: + ndbout << "Mediumunsigend"; + break; + case NdbDictionary::Column::Binary: + ndbout << "Binary"; + break; + case NdbDictionary::Column::Varbinary: + ndbout << "Varbinary"; + break; + case NdbDictionary::Column::Decimal: + ndbout << "Decimal"; + break; + case NdbDictionary::Column::Timespec: + ndbout << "Timespec"; + break; + case NdbDictionary::Column::Blob: + ndbout << "Blob"; + break; + case NdbDictionary::Column::Undefined: + ndbout << "Undefined"; + break; + default: + ndbout << "Unknown type=" << (Uint32)type; + break; + } + + return ndbout; +} diff --git a/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/ndb/src/ndbapi/NdbEventOperationImpl.cpp index 6ece69cce91..6730b637684 100644 --- a/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ b/ndb/src/ndbapi/NdbEventOperationImpl.cpp @@ -491,8 +491,7 @@ NdbEventOperationImpl::print() NdbRecAttr *p = theFirstRecAttrs[i]; ndbout << " %u " << i; while (p) { - ndbout << " : " << p->attrId() << " = "; - printRecAttr(p); + ndbout << " : " << p->attrId() << " = " << *p; p = p->next(); } ndbout << "\n"; @@ -1240,60 +1239,3 @@ NdbGlobalEventBuffer::real_wait(NdbGlobalEventBufferHandle *h, n += hasData(h->m_bufferIds[i]); return n; } - -/** - * TODO Change this function to use the real datatypes - * from NdbDictionary alternatively make a - * "printer" in NdbRecAttr that can be used from all programs - */ - -// and remove this include -#include "NdbSchemaOp.hpp" -void -NdbEventOperationImpl::printRecAttr(NdbRecAttr *p) -{ - int size = p->attrSize(); - int aSize = p->arraySize(); - - - switch(convertColumnTypeToAttrType(p->getType())){ - case UnSigned: - switch(size) { - case 8: ndbout << p->u_64_value(); break; - case 4: ndbout << p->u_32_value(); break; - case 2: ndbout << p->u_short_value(); break; - case 1: ndbout << (unsigned) p->u_char_value(); break; - default: ndbout << "Unknown size" << endl; - } - break; - - case Signed: - switch(size) { - case 8: ndbout << p->int64_value(); break; - case 4: ndbout << p->int32_value(); break; - case 2: ndbout << p->short_value(); break; - case 1: ndbout << (int) p->char_value(); break; - default: ndbout << "Unknown size" << endl; - } - break; - - case String: - { - char* buf = new char[aSize+1]; - memcpy(buf, p->aRef(), aSize); - buf[aSize] = 0; - ndbout << buf; - delete [] buf; - } - break; - - case Float: - ndbout << p->float_value(); - break; - - default: - ndbout << "Unknown"; - break; - } - -} diff --git a/ndb/src/ndbapi/NdbEventOperationImpl.hpp b/ndb/src/ndbapi/NdbEventOperationImpl.hpp index b7dee084a9f..f67c998e639 100644 --- a/ndb/src/ndbapi/NdbEventOperationImpl.hpp +++ b/ndb/src/ndbapi/NdbEventOperationImpl.hpp @@ -60,7 +60,6 @@ public: void print(); void printAll(); - void printRecAttr(NdbRecAttr *); Ndb *m_ndb; NdbEventImpl *m_eventImpl; diff --git a/ndb/src/ndbapi/NdbOperationDefine.cpp b/ndb/src/ndbapi/NdbOperationDefine.cpp index c174c6a629a..98d6caf60d4 100644 --- a/ndb/src/ndbapi/NdbOperationDefine.cpp +++ b/ndb/src/ndbapi/NdbOperationDefine.cpp @@ -472,9 +472,9 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo, tAttrId = tAttrInfo->m_attrId; const char *aValue = aValuePassed; Uint32 ahValue; - AttributeHeader& ah = AttributeHeader::init(&ahValue, tAttrId, 0); if (aValue == NULL) { if (tAttrInfo->m_nullable) { + AttributeHeader& ah = AttributeHeader::init(&ahValue, tAttrId, 0); ah.setNULL(); insertATTRINFO(ahValue); // Insert Attribute Id with the value @@ -508,7 +508,8 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo, }//if const Uint32 totalSizeInWords = (sizeInBytes + 3)/4; // Including bits in last word const Uint32 sizeInWords = sizeInBytes / 4; // Excluding bits in last word - ah.setDataSize(totalSizeInWords); + AttributeHeader& ah = AttributeHeader::init(&ahValue, tAttrId, + totalSizeInWords); insertATTRINFO( ahValue ); /*********************************************************************** diff --git a/ndb/src/ndbapi/NdbRecAttr.cpp b/ndb/src/ndbapi/NdbRecAttr.cpp index 18ce59745d0..ec10fc1d769 100644 --- a/ndb/src/ndbapi/NdbRecAttr.cpp +++ b/ndb/src/ndbapi/NdbRecAttr.cpp @@ -27,17 +27,14 @@ Documentation: Adjust: 971206 UABRONM First version ************************************************************************************************/ #include -#include "NdbRecAttr.hpp" +#include +#include #include "NdbDictionaryImpl.hpp" +#include -NdbRecAttr::NdbRecAttr() : - theStorageX(NULL), - theValue(NULL), - theRef(NULL), - theNext(NULL), - theAttrId(0xFFFF), - theNULLind(-1) -{ +NdbRecAttr::NdbRecAttr() +{ + init(); } NdbRecAttr::~NdbRecAttr() @@ -45,6 +42,11 @@ NdbRecAttr::~NdbRecAttr() release(); } +int +NdbRecAttr::setup(const class NdbDictionary::Column* col, char* aValue) +{ + return setup(&(col->m_impl), aValue); +} int NdbRecAttr::setup(const NdbColumnImpl* anAttrInfo, char* aValue) { @@ -53,6 +55,7 @@ NdbRecAttr::setup(const NdbColumnImpl* anAttrInfo, char* aValue) Uint32 tAttrByteSize = tAttrSize * tArraySize; m_column = anAttrInfo; + theAttrId = anAttrInfo->m_attrId; theAttrSize = tAttrSize; theArraySize = tArraySize; @@ -142,3 +145,80 @@ NdbRecAttr::receive_data(const Uint32 * data, Uint32 sz){ } return false; } + +NdbOut& operator<<(NdbOut& ndbout, const NdbRecAttr &r) +{ + if (r.isNULL()) + { + ndbout << "[NULL]"; + return ndbout; + } + + if (r.arraySize() > 1) + ndbout << "["; + + for (Uint32 j = 0; j < r.arraySize(); j++) + { + if (j > 0) + ndbout << " "; + + switch(r.getType()) + { + case NdbDictionary::Column::Bigunsigned: + ndbout << r.u_64_value(); + break; + case NdbDictionary::Column::Unsigned: + ndbout << r.u_32_value(); + break; + case NdbDictionary::Column::Smallunsigned: + ndbout << r.u_short_value(); + break; + case NdbDictionary::Column::Tinyunsigned: + ndbout << (unsigned) r.u_char_value(); + break; + case NdbDictionary::Column::Bigint: + ndbout << r.int64_value(); + break; + case NdbDictionary::Column::Int: + ndbout << r.int32_value(); + break; + case NdbDictionary::Column::Smallint: + ndbout << r.short_value(); + break; + case NdbDictionary::Column::Tinyint: + ndbout << (int) r.char_value(); + break; + case NdbDictionary::Column::Char: + ndbout.print("%.*s", r.arraySize(), r.aRef()); + j = r.arraySize(); + break; + case NdbDictionary::Column::Varchar: + { + short len = ntohs(r.u_short_value()); + ndbout.print("%.*s", len, r.aRef()+2); + } + j = r.arraySize(); + break; + case NdbDictionary::Column::Float: + ndbout << r.float_value(); + break; + case NdbDictionary::Column::Double: + ndbout << r.double_value(); + break; + default: /* no print functions for the rest, just print type */ + ndbout << r.getType(); + j = r.arraySize(); + if (j > 1) + ndbout << " %u times" << j; + break; + } + } + + if (r.arraySize() > 1) + { + ndbout << "]"; + } + + return ndbout; +>>>>>>> +} diff --git a/ndb/src/ndbapi/Ndberr.cpp b/ndb/src/ndbapi/Ndberr.cpp index faa2f00cfce..14982116bbd 100644 --- a/ndb/src/ndbapi/Ndberr.cpp +++ b/ndb/src/ndbapi/Ndberr.cpp @@ -18,7 +18,6 @@ #include #include "NdbImpl.hpp" #include "NdbDictionaryImpl.hpp" -#include #include #include @@ -66,10 +65,3 @@ NdbOperation::getNdbError() const { update(theError); return theError; } - -const -NdbError & -NdbSchemaCon::getNdbError() const { - update(theError); - return theError; -} diff --git a/ndb/src/client/Makefile b/ndb/src/old_files/client/Makefile similarity index 100% rename from ndb/src/client/Makefile rename to ndb/src/old_files/client/Makefile diff --git a/ndb/src/client/odbc/Extra.mk b/ndb/src/old_files/client/odbc/Extra.mk similarity index 100% rename from ndb/src/client/odbc/Extra.mk rename to ndb/src/old_files/client/odbc/Extra.mk diff --git a/ndb/src/client/odbc/Makefile b/ndb/src/old_files/client/odbc/Makefile similarity index 100% rename from ndb/src/client/odbc/Makefile rename to ndb/src/old_files/client/odbc/Makefile diff --git a/ndb/src/client/odbc/NdbOdbc.cpp b/ndb/src/old_files/client/odbc/NdbOdbc.cpp similarity index 100% rename from ndb/src/client/odbc/NdbOdbc.cpp rename to ndb/src/old_files/client/odbc/NdbOdbc.cpp diff --git a/ndb/src/client/odbc/NdbOdbc.def b/ndb/src/old_files/client/odbc/NdbOdbc.def similarity index 100% rename from ndb/src/client/odbc/NdbOdbc.def rename to ndb/src/old_files/client/odbc/NdbOdbc.def diff --git a/ndb/src/client/odbc/codegen/CodeGen.cpp b/ndb/src/old_files/client/odbc/codegen/CodeGen.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/CodeGen.cpp rename to ndb/src/old_files/client/odbc/codegen/CodeGen.cpp diff --git a/ndb/src/client/odbc/codegen/CodeGen.hpp b/ndb/src/old_files/client/odbc/codegen/CodeGen.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/CodeGen.hpp rename to ndb/src/old_files/client/odbc/codegen/CodeGen.hpp diff --git a/ndb/src/client/odbc/codegen/Code_base.cpp b/ndb/src/old_files/client/odbc/codegen/Code_base.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_base.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_base.cpp diff --git a/ndb/src/client/odbc/codegen/Code_base.hpp b/ndb/src/old_files/client/odbc/codegen/Code_base.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_base.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_base.hpp diff --git a/ndb/src/client/odbc/codegen/Code_column.cpp b/ndb/src/old_files/client/odbc/codegen/Code_column.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_column.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_column.cpp diff --git a/ndb/src/client/odbc/codegen/Code_column.hpp b/ndb/src/old_files/client/odbc/codegen/Code_column.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_column.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_column.hpp diff --git a/ndb/src/client/odbc/codegen/Code_comp_op.cpp b/ndb/src/old_files/client/odbc/codegen/Code_comp_op.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_comp_op.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_comp_op.cpp diff --git a/ndb/src/client/odbc/codegen/Code_comp_op.hpp b/ndb/src/old_files/client/odbc/codegen/Code_comp_op.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_comp_op.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_comp_op.hpp diff --git a/ndb/src/client/odbc/codegen/Code_create_index.cpp b/ndb/src/old_files/client/odbc/codegen/Code_create_index.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_create_index.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_create_index.cpp diff --git a/ndb/src/client/odbc/codegen/Code_create_index.hpp b/ndb/src/old_files/client/odbc/codegen/Code_create_index.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_create_index.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_create_index.hpp diff --git a/ndb/src/client/odbc/codegen/Code_create_row.cpp b/ndb/src/old_files/client/odbc/codegen/Code_create_row.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_create_row.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_create_row.cpp diff --git a/ndb/src/client/odbc/codegen/Code_create_row.hpp b/ndb/src/old_files/client/odbc/codegen/Code_create_row.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_create_row.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_create_row.hpp diff --git a/ndb/src/client/odbc/codegen/Code_create_table.cpp b/ndb/src/old_files/client/odbc/codegen/Code_create_table.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_create_table.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_create_table.cpp diff --git a/ndb/src/client/odbc/codegen/Code_create_table.hpp b/ndb/src/old_files/client/odbc/codegen/Code_create_table.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_create_table.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_create_table.hpp diff --git a/ndb/src/client/odbc/codegen/Code_data_type.cpp b/ndb/src/old_files/client/odbc/codegen/Code_data_type.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_data_type.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_data_type.cpp diff --git a/ndb/src/client/odbc/codegen/Code_data_type.hpp b/ndb/src/old_files/client/odbc/codegen/Code_data_type.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_data_type.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_data_type.hpp diff --git a/ndb/src/client/odbc/codegen/Code_ddl.cpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_ddl.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_ddl.cpp diff --git a/ndb/src/client/odbc/codegen/Code_ddl.hpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_ddl.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_ddl.hpp diff --git a/ndb/src/client/odbc/codegen/Code_ddl_column.cpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_ddl_column.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_ddl_column.cpp diff --git a/ndb/src/client/odbc/codegen/Code_ddl_column.hpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl_column.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_ddl_column.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_ddl_column.hpp diff --git a/ndb/src/client/odbc/codegen/Code_ddl_constr.cpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_ddl_constr.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.cpp diff --git a/ndb/src/client/odbc/codegen/Code_ddl_constr.hpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_ddl_constr.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_ddl_constr.hpp diff --git a/ndb/src/client/odbc/codegen/Code_ddl_row.cpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_ddl_row.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_ddl_row.cpp diff --git a/ndb/src/client/odbc/codegen/Code_ddl_row.hpp b/ndb/src/old_files/client/odbc/codegen/Code_ddl_row.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_ddl_row.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_ddl_row.hpp diff --git a/ndb/src/client/odbc/codegen/Code_delete.cpp b/ndb/src/old_files/client/odbc/codegen/Code_delete.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_delete.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_delete.cpp diff --git a/ndb/src/client/odbc/codegen/Code_delete.hpp b/ndb/src/old_files/client/odbc/codegen/Code_delete.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_delete.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_delete.hpp diff --git a/ndb/src/client/odbc/codegen/Code_delete_index.cpp b/ndb/src/old_files/client/odbc/codegen/Code_delete_index.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_delete_index.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_delete_index.cpp diff --git a/ndb/src/client/odbc/codegen/Code_delete_index.hpp b/ndb/src/old_files/client/odbc/codegen/Code_delete_index.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_delete_index.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_delete_index.hpp diff --git a/ndb/src/client/odbc/codegen/Code_delete_lookup.cpp b/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_delete_lookup.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.cpp diff --git a/ndb/src/client/odbc/codegen/Code_delete_lookup.hpp b/ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_delete_lookup.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_delete_lookup.hpp diff --git a/ndb/src/client/odbc/codegen/Code_delete_scan.cpp b/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_delete_scan.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_delete_scan.cpp diff --git a/ndb/src/client/odbc/codegen/Code_delete_scan.hpp b/ndb/src/old_files/client/odbc/codegen/Code_delete_scan.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_delete_scan.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_delete_scan.hpp diff --git a/ndb/src/client/odbc/codegen/Code_dml.cpp b/ndb/src/old_files/client/odbc/codegen/Code_dml.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_dml.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_dml.cpp diff --git a/ndb/src/client/odbc/codegen/Code_dml.hpp b/ndb/src/old_files/client/odbc/codegen/Code_dml.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_dml.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_dml.hpp diff --git a/ndb/src/client/odbc/codegen/Code_dml_column.cpp b/ndb/src/old_files/client/odbc/codegen/Code_dml_column.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_dml_column.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_dml_column.cpp diff --git a/ndb/src/client/odbc/codegen/Code_dml_column.hpp b/ndb/src/old_files/client/odbc/codegen/Code_dml_column.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_dml_column.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_dml_column.hpp diff --git a/ndb/src/client/odbc/codegen/Code_dml_row.cpp b/ndb/src/old_files/client/odbc/codegen/Code_dml_row.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_dml_row.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_dml_row.cpp diff --git a/ndb/src/client/odbc/codegen/Code_dml_row.hpp b/ndb/src/old_files/client/odbc/codegen/Code_dml_row.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_dml_row.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_dml_row.hpp diff --git a/ndb/src/client/odbc/codegen/Code_drop_index.cpp b/ndb/src/old_files/client/odbc/codegen/Code_drop_index.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_drop_index.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_drop_index.cpp diff --git a/ndb/src/client/odbc/codegen/Code_drop_index.hpp b/ndb/src/old_files/client/odbc/codegen/Code_drop_index.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_drop_index.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_drop_index.hpp diff --git a/ndb/src/client/odbc/codegen/Code_drop_table.cpp b/ndb/src/old_files/client/odbc/codegen/Code_drop_table.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_drop_table.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_drop_table.cpp diff --git a/ndb/src/client/odbc/codegen/Code_drop_table.hpp b/ndb/src/old_files/client/odbc/codegen/Code_drop_table.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_drop_table.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_drop_table.hpp diff --git a/ndb/src/client/odbc/codegen/Code_expr.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr.cpp diff --git a/ndb/src/client/odbc/codegen/Code_expr.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr.hpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_column.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_column.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_column.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_column.cpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_column.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_column.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_column.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_column.hpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_const.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_const.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_const.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_const.cpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_const.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_const.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_const.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_const.hpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_conv.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_conv.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_conv.cpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_conv.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_conv.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_conv.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_conv.hpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_func.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_func.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_func.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_func.cpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_func.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_func.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_func.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_func.hpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_op.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_op.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_op.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_op.cpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_op.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_op.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_op.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_op.hpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_param.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_param.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_param.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_param.cpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_param.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_param.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_param.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_param.hpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_row.cpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_row.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_row.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_row.cpp diff --git a/ndb/src/client/odbc/codegen/Code_expr_row.hpp b/ndb/src/old_files/client/odbc/codegen/Code_expr_row.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_expr_row.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_expr_row.hpp diff --git a/ndb/src/client/odbc/codegen/Code_idx_column.cpp b/ndb/src/old_files/client/odbc/codegen/Code_idx_column.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_idx_column.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_idx_column.cpp diff --git a/ndb/src/client/odbc/codegen/Code_idx_column.hpp b/ndb/src/old_files/client/odbc/codegen/Code_idx_column.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_idx_column.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_idx_column.hpp diff --git a/ndb/src/client/odbc/codegen/Code_insert.cpp b/ndb/src/old_files/client/odbc/codegen/Code_insert.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_insert.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_insert.cpp diff --git a/ndb/src/client/odbc/codegen/Code_insert.hpp b/ndb/src/old_files/client/odbc/codegen/Code_insert.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_insert.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_insert.hpp diff --git a/ndb/src/client/odbc/codegen/Code_pred.cpp b/ndb/src/old_files/client/odbc/codegen/Code_pred.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_pred.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_pred.cpp diff --git a/ndb/src/client/odbc/codegen/Code_pred.hpp b/ndb/src/old_files/client/odbc/codegen/Code_pred.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_pred.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_pred.hpp diff --git a/ndb/src/client/odbc/codegen/Code_pred_op.cpp b/ndb/src/old_files/client/odbc/codegen/Code_pred_op.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_pred_op.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_pred_op.cpp diff --git a/ndb/src/client/odbc/codegen/Code_pred_op.hpp b/ndb/src/old_files/client/odbc/codegen/Code_pred_op.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_pred_op.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_pred_op.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query_count.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_count.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_count.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_count.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query_count.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_count.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_count.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_count.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query_distinct.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_distinct.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_distinct.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query_distinct.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_distinct.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_distinct.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_distinct.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query_filter.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_filter.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_filter.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_filter.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query_filter.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_filter.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_filter.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_filter.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query_group.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_group.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_group.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_group.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query_group.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_group.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_group.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_group.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query_index.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_index.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_index.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_index.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query_index.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_index.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_index.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_index.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query_join.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_join.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_join.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_join.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query_join.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_join.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_join.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_join.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query_lookup.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_lookup.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_lookup.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query_lookup.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_lookup.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_lookup.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_lookup.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query_project.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_project.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_project.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_project.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query_project.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_project.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_project.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_project.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query_range.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_range.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_range.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_range.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query_range.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_range.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_range.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_range.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query_repeat.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_repeat.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_repeat.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query_repeat.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_repeat.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_repeat.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_repeat.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query_scan.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_scan.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_scan.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_scan.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query_scan.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_scan.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_scan.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_scan.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query_sort.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_sort.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_sort.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_sort.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query_sort.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_sort.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_sort.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_sort.hpp diff --git a/ndb/src/client/odbc/codegen/Code_query_sys.cpp b/ndb/src/old_files/client/odbc/codegen/Code_query_sys.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_sys.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_sys.cpp diff --git a/ndb/src/client/odbc/codegen/Code_query_sys.hpp b/ndb/src/old_files/client/odbc/codegen/Code_query_sys.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_query_sys.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_query_sys.hpp diff --git a/ndb/src/client/odbc/codegen/Code_root.cpp b/ndb/src/old_files/client/odbc/codegen/Code_root.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_root.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_root.cpp diff --git a/ndb/src/client/odbc/codegen/Code_root.hpp b/ndb/src/old_files/client/odbc/codegen/Code_root.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_root.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_root.hpp diff --git a/ndb/src/client/odbc/codegen/Code_select.cpp b/ndb/src/old_files/client/odbc/codegen/Code_select.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_select.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_select.cpp diff --git a/ndb/src/client/odbc/codegen/Code_select.hpp b/ndb/src/old_files/client/odbc/codegen/Code_select.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_select.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_select.hpp diff --git a/ndb/src/client/odbc/codegen/Code_set_row.cpp b/ndb/src/old_files/client/odbc/codegen/Code_set_row.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_set_row.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_set_row.cpp diff --git a/ndb/src/client/odbc/codegen/Code_set_row.hpp b/ndb/src/old_files/client/odbc/codegen/Code_set_row.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_set_row.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_set_row.hpp diff --git a/ndb/src/client/odbc/codegen/Code_stmt.cpp b/ndb/src/old_files/client/odbc/codegen/Code_stmt.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_stmt.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_stmt.cpp diff --git a/ndb/src/client/odbc/codegen/Code_stmt.hpp b/ndb/src/old_files/client/odbc/codegen/Code_stmt.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_stmt.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_stmt.hpp diff --git a/ndb/src/client/odbc/codegen/Code_table.cpp b/ndb/src/old_files/client/odbc/codegen/Code_table.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_table.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_table.cpp diff --git a/ndb/src/client/odbc/codegen/Code_table.hpp b/ndb/src/old_files/client/odbc/codegen/Code_table.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_table.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_table.hpp diff --git a/ndb/src/client/odbc/codegen/Code_table_list.cpp b/ndb/src/old_files/client/odbc/codegen/Code_table_list.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_table_list.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_table_list.cpp diff --git a/ndb/src/client/odbc/codegen/Code_table_list.hpp b/ndb/src/old_files/client/odbc/codegen/Code_table_list.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_table_list.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_table_list.hpp diff --git a/ndb/src/client/odbc/codegen/Code_update.cpp b/ndb/src/old_files/client/odbc/codegen/Code_update.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_update.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_update.cpp diff --git a/ndb/src/client/odbc/codegen/Code_update.hpp b/ndb/src/old_files/client/odbc/codegen/Code_update.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_update.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_update.hpp diff --git a/ndb/src/client/odbc/codegen/Code_update_index.cpp b/ndb/src/old_files/client/odbc/codegen/Code_update_index.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_update_index.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_update_index.cpp diff --git a/ndb/src/client/odbc/codegen/Code_update_index.hpp b/ndb/src/old_files/client/odbc/codegen/Code_update_index.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_update_index.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_update_index.hpp diff --git a/ndb/src/client/odbc/codegen/Code_update_lookup.cpp b/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_update_lookup.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_update_lookup.cpp diff --git a/ndb/src/client/odbc/codegen/Code_update_lookup.hpp b/ndb/src/old_files/client/odbc/codegen/Code_update_lookup.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_update_lookup.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_update_lookup.hpp diff --git a/ndb/src/client/odbc/codegen/Code_update_scan.cpp b/ndb/src/old_files/client/odbc/codegen/Code_update_scan.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_update_scan.cpp rename to ndb/src/old_files/client/odbc/codegen/Code_update_scan.cpp diff --git a/ndb/src/client/odbc/codegen/Code_update_scan.hpp b/ndb/src/old_files/client/odbc/codegen/Code_update_scan.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/Code_update_scan.hpp rename to ndb/src/old_files/client/odbc/codegen/Code_update_scan.hpp diff --git a/ndb/src/client/odbc/codegen/Makefile b/ndb/src/old_files/client/odbc/codegen/Makefile similarity index 100% rename from ndb/src/client/odbc/codegen/Makefile rename to ndb/src/old_files/client/odbc/codegen/Makefile diff --git a/ndb/src/client/odbc/codegen/SimpleGram.ypp b/ndb/src/old_files/client/odbc/codegen/SimpleGram.ypp similarity index 100% rename from ndb/src/client/odbc/codegen/SimpleGram.ypp rename to ndb/src/old_files/client/odbc/codegen/SimpleGram.ypp diff --git a/ndb/src/client/odbc/codegen/SimpleParser.cpp b/ndb/src/old_files/client/odbc/codegen/SimpleParser.cpp similarity index 100% rename from ndb/src/client/odbc/codegen/SimpleParser.cpp rename to ndb/src/old_files/client/odbc/codegen/SimpleParser.cpp diff --git a/ndb/src/client/odbc/codegen/SimpleParser.hpp b/ndb/src/old_files/client/odbc/codegen/SimpleParser.hpp similarity index 100% rename from ndb/src/client/odbc/codegen/SimpleParser.hpp rename to ndb/src/old_files/client/odbc/codegen/SimpleParser.hpp diff --git a/ndb/src/client/odbc/codegen/SimpleScan.lpp b/ndb/src/old_files/client/odbc/codegen/SimpleScan.lpp similarity index 100% rename from ndb/src/client/odbc/codegen/SimpleScan.lpp rename to ndb/src/old_files/client/odbc/codegen/SimpleScan.lpp diff --git a/ndb/src/client/odbc/common/AttrArea.cpp b/ndb/src/old_files/client/odbc/common/AttrArea.cpp similarity index 100% rename from ndb/src/client/odbc/common/AttrArea.cpp rename to ndb/src/old_files/client/odbc/common/AttrArea.cpp diff --git a/ndb/src/client/odbc/common/AttrArea.hpp b/ndb/src/old_files/client/odbc/common/AttrArea.hpp similarity index 100% rename from ndb/src/client/odbc/common/AttrArea.hpp rename to ndb/src/old_files/client/odbc/common/AttrArea.hpp diff --git a/ndb/src/client/odbc/common/CodeTree.cpp b/ndb/src/old_files/client/odbc/common/CodeTree.cpp similarity index 100% rename from ndb/src/client/odbc/common/CodeTree.cpp rename to ndb/src/old_files/client/odbc/common/CodeTree.cpp diff --git a/ndb/src/client/odbc/common/CodeTree.hpp b/ndb/src/old_files/client/odbc/common/CodeTree.hpp similarity index 100% rename from ndb/src/client/odbc/common/CodeTree.hpp rename to ndb/src/old_files/client/odbc/common/CodeTree.hpp diff --git a/ndb/src/client/odbc/common/ConnArea.cpp b/ndb/src/old_files/client/odbc/common/ConnArea.cpp similarity index 100% rename from ndb/src/client/odbc/common/ConnArea.cpp rename to ndb/src/old_files/client/odbc/common/ConnArea.cpp diff --git a/ndb/src/client/odbc/common/ConnArea.hpp b/ndb/src/old_files/client/odbc/common/ConnArea.hpp similarity index 100% rename from ndb/src/client/odbc/common/ConnArea.hpp rename to ndb/src/old_files/client/odbc/common/ConnArea.hpp diff --git a/ndb/src/client/odbc/common/Ctx.cpp b/ndb/src/old_files/client/odbc/common/Ctx.cpp similarity index 100% rename from ndb/src/client/odbc/common/Ctx.cpp rename to ndb/src/old_files/client/odbc/common/Ctx.cpp diff --git a/ndb/src/client/odbc/common/Ctx.hpp b/ndb/src/old_files/client/odbc/common/Ctx.hpp similarity index 100% rename from ndb/src/client/odbc/common/Ctx.hpp rename to ndb/src/old_files/client/odbc/common/Ctx.hpp diff --git a/ndb/src/client/odbc/common/DataField.cpp b/ndb/src/old_files/client/odbc/common/DataField.cpp similarity index 100% rename from ndb/src/client/odbc/common/DataField.cpp rename to ndb/src/old_files/client/odbc/common/DataField.cpp diff --git a/ndb/src/client/odbc/common/DataField.hpp b/ndb/src/old_files/client/odbc/common/DataField.hpp similarity index 100% rename from ndb/src/client/odbc/common/DataField.hpp rename to ndb/src/old_files/client/odbc/common/DataField.hpp diff --git a/ndb/src/client/odbc/common/DataRow.cpp b/ndb/src/old_files/client/odbc/common/DataRow.cpp similarity index 100% rename from ndb/src/client/odbc/common/DataRow.cpp rename to ndb/src/old_files/client/odbc/common/DataRow.cpp diff --git a/ndb/src/client/odbc/common/DataRow.hpp b/ndb/src/old_files/client/odbc/common/DataRow.hpp similarity index 100% rename from ndb/src/client/odbc/common/DataRow.hpp rename to ndb/src/old_files/client/odbc/common/DataRow.hpp diff --git a/ndb/src/client/odbc/common/DataType.cpp b/ndb/src/old_files/client/odbc/common/DataType.cpp similarity index 100% rename from ndb/src/client/odbc/common/DataType.cpp rename to ndb/src/old_files/client/odbc/common/DataType.cpp diff --git a/ndb/src/client/odbc/common/DataType.hpp b/ndb/src/old_files/client/odbc/common/DataType.hpp similarity index 100% rename from ndb/src/client/odbc/common/DataType.hpp rename to ndb/src/old_files/client/odbc/common/DataType.hpp diff --git a/ndb/src/client/odbc/common/DescArea.cpp b/ndb/src/old_files/client/odbc/common/DescArea.cpp similarity index 100% rename from ndb/src/client/odbc/common/DescArea.cpp rename to ndb/src/old_files/client/odbc/common/DescArea.cpp diff --git a/ndb/src/client/odbc/common/DescArea.hpp b/ndb/src/old_files/client/odbc/common/DescArea.hpp similarity index 100% rename from ndb/src/client/odbc/common/DescArea.hpp rename to ndb/src/old_files/client/odbc/common/DescArea.hpp diff --git a/ndb/src/client/odbc/common/DiagArea.cpp b/ndb/src/old_files/client/odbc/common/DiagArea.cpp similarity index 100% rename from ndb/src/client/odbc/common/DiagArea.cpp rename to ndb/src/old_files/client/odbc/common/DiagArea.cpp diff --git a/ndb/src/client/odbc/common/DiagArea.hpp b/ndb/src/old_files/client/odbc/common/DiagArea.hpp similarity index 100% rename from ndb/src/client/odbc/common/DiagArea.hpp rename to ndb/src/old_files/client/odbc/common/DiagArea.hpp diff --git a/ndb/src/client/odbc/common/Makefile b/ndb/src/old_files/client/odbc/common/Makefile similarity index 100% rename from ndb/src/client/odbc/common/Makefile rename to ndb/src/old_files/client/odbc/common/Makefile diff --git a/ndb/src/client/odbc/common/OdbcData.cpp b/ndb/src/old_files/client/odbc/common/OdbcData.cpp similarity index 100% rename from ndb/src/client/odbc/common/OdbcData.cpp rename to ndb/src/old_files/client/odbc/common/OdbcData.cpp diff --git a/ndb/src/client/odbc/common/OdbcData.hpp b/ndb/src/old_files/client/odbc/common/OdbcData.hpp similarity index 100% rename from ndb/src/client/odbc/common/OdbcData.hpp rename to ndb/src/old_files/client/odbc/common/OdbcData.hpp diff --git a/ndb/src/client/odbc/common/ResultArea.cpp b/ndb/src/old_files/client/odbc/common/ResultArea.cpp similarity index 100% rename from ndb/src/client/odbc/common/ResultArea.cpp rename to ndb/src/old_files/client/odbc/common/ResultArea.cpp diff --git a/ndb/src/client/odbc/common/ResultArea.hpp b/ndb/src/old_files/client/odbc/common/ResultArea.hpp similarity index 100% rename from ndb/src/client/odbc/common/ResultArea.hpp rename to ndb/src/old_files/client/odbc/common/ResultArea.hpp diff --git a/ndb/src/client/odbc/common/Sqlstate.cpp b/ndb/src/old_files/client/odbc/common/Sqlstate.cpp similarity index 100% rename from ndb/src/client/odbc/common/Sqlstate.cpp rename to ndb/src/old_files/client/odbc/common/Sqlstate.cpp diff --git a/ndb/src/client/odbc/common/Sqlstate.hpp b/ndb/src/old_files/client/odbc/common/Sqlstate.hpp similarity index 100% rename from ndb/src/client/odbc/common/Sqlstate.hpp rename to ndb/src/old_files/client/odbc/common/Sqlstate.hpp diff --git a/ndb/src/client/odbc/common/StmtArea.cpp b/ndb/src/old_files/client/odbc/common/StmtArea.cpp similarity index 100% rename from ndb/src/client/odbc/common/StmtArea.cpp rename to ndb/src/old_files/client/odbc/common/StmtArea.cpp diff --git a/ndb/src/client/odbc/common/StmtArea.hpp b/ndb/src/old_files/client/odbc/common/StmtArea.hpp similarity index 100% rename from ndb/src/client/odbc/common/StmtArea.hpp rename to ndb/src/old_files/client/odbc/common/StmtArea.hpp diff --git a/ndb/src/client/odbc/common/StmtInfo.cpp b/ndb/src/old_files/client/odbc/common/StmtInfo.cpp similarity index 100% rename from ndb/src/client/odbc/common/StmtInfo.cpp rename to ndb/src/old_files/client/odbc/common/StmtInfo.cpp diff --git a/ndb/src/client/odbc/common/StmtInfo.hpp b/ndb/src/old_files/client/odbc/common/StmtInfo.hpp similarity index 100% rename from ndb/src/client/odbc/common/StmtInfo.hpp rename to ndb/src/old_files/client/odbc/common/StmtInfo.hpp diff --git a/ndb/src/client/odbc/common/common.cpp b/ndb/src/old_files/client/odbc/common/common.cpp similarity index 100% rename from ndb/src/client/odbc/common/common.cpp rename to ndb/src/old_files/client/odbc/common/common.cpp diff --git a/ndb/src/client/odbc/common/common.hpp b/ndb/src/old_files/client/odbc/common/common.hpp similarity index 100% rename from ndb/src/client/odbc/common/common.hpp rename to ndb/src/old_files/client/odbc/common/common.hpp diff --git a/ndb/src/client/odbc/dictionary/DictCatalog.cpp b/ndb/src/old_files/client/odbc/dictionary/DictCatalog.cpp similarity index 100% rename from ndb/src/client/odbc/dictionary/DictCatalog.cpp rename to ndb/src/old_files/client/odbc/dictionary/DictCatalog.cpp diff --git a/ndb/src/client/odbc/dictionary/DictCatalog.hpp b/ndb/src/old_files/client/odbc/dictionary/DictCatalog.hpp similarity index 100% rename from ndb/src/client/odbc/dictionary/DictCatalog.hpp rename to ndb/src/old_files/client/odbc/dictionary/DictCatalog.hpp diff --git a/ndb/src/client/odbc/dictionary/DictColumn.cpp b/ndb/src/old_files/client/odbc/dictionary/DictColumn.cpp similarity index 100% rename from ndb/src/client/odbc/dictionary/DictColumn.cpp rename to ndb/src/old_files/client/odbc/dictionary/DictColumn.cpp diff --git a/ndb/src/client/odbc/dictionary/DictColumn.hpp b/ndb/src/old_files/client/odbc/dictionary/DictColumn.hpp similarity index 100% rename from ndb/src/client/odbc/dictionary/DictColumn.hpp rename to ndb/src/old_files/client/odbc/dictionary/DictColumn.hpp diff --git a/ndb/src/client/odbc/dictionary/DictIndex.cpp b/ndb/src/old_files/client/odbc/dictionary/DictIndex.cpp similarity index 100% rename from ndb/src/client/odbc/dictionary/DictIndex.cpp rename to ndb/src/old_files/client/odbc/dictionary/DictIndex.cpp diff --git a/ndb/src/client/odbc/dictionary/DictIndex.hpp b/ndb/src/old_files/client/odbc/dictionary/DictIndex.hpp similarity index 100% rename from ndb/src/client/odbc/dictionary/DictIndex.hpp rename to ndb/src/old_files/client/odbc/dictionary/DictIndex.hpp diff --git a/ndb/src/client/odbc/dictionary/DictSchema.cpp b/ndb/src/old_files/client/odbc/dictionary/DictSchema.cpp similarity index 100% rename from ndb/src/client/odbc/dictionary/DictSchema.cpp rename to ndb/src/old_files/client/odbc/dictionary/DictSchema.cpp diff --git a/ndb/src/client/odbc/dictionary/DictSchema.hpp b/ndb/src/old_files/client/odbc/dictionary/DictSchema.hpp similarity index 100% rename from ndb/src/client/odbc/dictionary/DictSchema.hpp rename to ndb/src/old_files/client/odbc/dictionary/DictSchema.hpp diff --git a/ndb/src/client/odbc/dictionary/DictSys.cpp b/ndb/src/old_files/client/odbc/dictionary/DictSys.cpp similarity index 100% rename from ndb/src/client/odbc/dictionary/DictSys.cpp rename to ndb/src/old_files/client/odbc/dictionary/DictSys.cpp diff --git a/ndb/src/client/odbc/dictionary/DictSys.hpp b/ndb/src/old_files/client/odbc/dictionary/DictSys.hpp similarity index 100% rename from ndb/src/client/odbc/dictionary/DictSys.hpp rename to ndb/src/old_files/client/odbc/dictionary/DictSys.hpp diff --git a/ndb/src/client/odbc/dictionary/DictTable.cpp b/ndb/src/old_files/client/odbc/dictionary/DictTable.cpp similarity index 100% rename from ndb/src/client/odbc/dictionary/DictTable.cpp rename to ndb/src/old_files/client/odbc/dictionary/DictTable.cpp diff --git a/ndb/src/client/odbc/dictionary/DictTable.hpp b/ndb/src/old_files/client/odbc/dictionary/DictTable.hpp similarity index 100% rename from ndb/src/client/odbc/dictionary/DictTable.hpp rename to ndb/src/old_files/client/odbc/dictionary/DictTable.hpp diff --git a/ndb/src/client/odbc/dictionary/Makefile b/ndb/src/old_files/client/odbc/dictionary/Makefile similarity index 100% rename from ndb/src/client/odbc/dictionary/Makefile rename to ndb/src/old_files/client/odbc/dictionary/Makefile diff --git a/ndb/src/client/odbc/docs/class.fig b/ndb/src/old_files/client/odbc/docs/class.fig similarity index 100% rename from ndb/src/client/odbc/docs/class.fig rename to ndb/src/old_files/client/odbc/docs/class.fig diff --git a/ndb/src/client/odbc/docs/descfield.pl b/ndb/src/old_files/client/odbc/docs/descfield.pl similarity index 100% rename from ndb/src/client/odbc/docs/descfield.pl rename to ndb/src/old_files/client/odbc/docs/descfield.pl diff --git a/ndb/src/client/odbc/docs/diag.txt b/ndb/src/old_files/client/odbc/docs/diag.txt similarity index 100% rename from ndb/src/client/odbc/docs/diag.txt rename to ndb/src/old_files/client/odbc/docs/diag.txt diff --git a/ndb/src/client/odbc/docs/getinfo.pl b/ndb/src/old_files/client/odbc/docs/getinfo.pl similarity index 100% rename from ndb/src/client/odbc/docs/getinfo.pl rename to ndb/src/old_files/client/odbc/docs/getinfo.pl diff --git a/ndb/src/client/odbc/docs/gettypeinfo.pl b/ndb/src/old_files/client/odbc/docs/gettypeinfo.pl similarity index 100% rename from ndb/src/client/odbc/docs/gettypeinfo.pl rename to ndb/src/old_files/client/odbc/docs/gettypeinfo.pl diff --git a/ndb/src/client/odbc/docs/handleattr.pl b/ndb/src/old_files/client/odbc/docs/handleattr.pl similarity index 100% rename from ndb/src/client/odbc/docs/handleattr.pl rename to ndb/src/old_files/client/odbc/docs/handleattr.pl diff --git a/ndb/src/client/odbc/docs/main.hpp b/ndb/src/old_files/client/odbc/docs/main.hpp similarity index 100% rename from ndb/src/client/odbc/docs/main.hpp rename to ndb/src/old_files/client/odbc/docs/main.hpp diff --git a/ndb/src/client/odbc/docs/ndbodbc.html b/ndb/src/old_files/client/odbc/docs/ndbodbc.html similarity index 100% rename from ndb/src/client/odbc/docs/ndbodbc.html rename to ndb/src/old_files/client/odbc/docs/ndbodbc.html diff --git a/ndb/src/client/odbc/docs/select.fig b/ndb/src/old_files/client/odbc/docs/select.fig similarity index 100% rename from ndb/src/client/odbc/docs/select.fig rename to ndb/src/old_files/client/odbc/docs/select.fig diff --git a/ndb/src/client/odbc/docs/systables.pl b/ndb/src/old_files/client/odbc/docs/systables.pl similarity index 100% rename from ndb/src/client/odbc/docs/systables.pl rename to ndb/src/old_files/client/odbc/docs/systables.pl diff --git a/ndb/src/client/odbc/docs/type.txt b/ndb/src/old_files/client/odbc/docs/type.txt similarity index 100% rename from ndb/src/client/odbc/docs/type.txt rename to ndb/src/old_files/client/odbc/docs/type.txt diff --git a/ndb/src/client/odbc/driver/Func.data b/ndb/src/old_files/client/odbc/driver/Func.data similarity index 100% rename from ndb/src/client/odbc/driver/Func.data rename to ndb/src/old_files/client/odbc/driver/Func.data diff --git a/ndb/src/client/odbc/driver/Func.pl b/ndb/src/old_files/client/odbc/driver/Func.pl similarity index 100% rename from ndb/src/client/odbc/driver/Func.pl rename to ndb/src/old_files/client/odbc/driver/Func.pl diff --git a/ndb/src/client/odbc/driver/Makefile b/ndb/src/old_files/client/odbc/driver/Makefile similarity index 100% rename from ndb/src/client/odbc/driver/Makefile rename to ndb/src/old_files/client/odbc/driver/Makefile diff --git a/ndb/src/client/odbc/driver/SQLAllocConnect.cpp b/ndb/src/old_files/client/odbc/driver/SQLAllocConnect.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLAllocConnect.cpp rename to ndb/src/old_files/client/odbc/driver/SQLAllocConnect.cpp diff --git a/ndb/src/client/odbc/driver/SQLAllocEnv.cpp b/ndb/src/old_files/client/odbc/driver/SQLAllocEnv.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLAllocEnv.cpp rename to ndb/src/old_files/client/odbc/driver/SQLAllocEnv.cpp diff --git a/ndb/src/client/odbc/driver/SQLAllocHandle.cpp b/ndb/src/old_files/client/odbc/driver/SQLAllocHandle.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLAllocHandle.cpp rename to ndb/src/old_files/client/odbc/driver/SQLAllocHandle.cpp diff --git a/ndb/src/client/odbc/driver/SQLAllocHandleStd.cpp b/ndb/src/old_files/client/odbc/driver/SQLAllocHandleStd.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLAllocHandleStd.cpp rename to ndb/src/old_files/client/odbc/driver/SQLAllocHandleStd.cpp diff --git a/ndb/src/client/odbc/driver/SQLAllocStmt.cpp b/ndb/src/old_files/client/odbc/driver/SQLAllocStmt.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLAllocStmt.cpp rename to ndb/src/old_files/client/odbc/driver/SQLAllocStmt.cpp diff --git a/ndb/src/client/odbc/driver/SQLBindCol.cpp b/ndb/src/old_files/client/odbc/driver/SQLBindCol.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLBindCol.cpp rename to ndb/src/old_files/client/odbc/driver/SQLBindCol.cpp diff --git a/ndb/src/client/odbc/driver/SQLBindParam.cpp b/ndb/src/old_files/client/odbc/driver/SQLBindParam.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLBindParam.cpp rename to ndb/src/old_files/client/odbc/driver/SQLBindParam.cpp diff --git a/ndb/src/client/odbc/driver/SQLBindParameter.cpp b/ndb/src/old_files/client/odbc/driver/SQLBindParameter.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLBindParameter.cpp rename to ndb/src/old_files/client/odbc/driver/SQLBindParameter.cpp diff --git a/ndb/src/client/odbc/driver/SQLBrowseConnect.cpp b/ndb/src/old_files/client/odbc/driver/SQLBrowseConnect.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLBrowseConnect.cpp rename to ndb/src/old_files/client/odbc/driver/SQLBrowseConnect.cpp diff --git a/ndb/src/client/odbc/driver/SQLBulkOperations.cpp b/ndb/src/old_files/client/odbc/driver/SQLBulkOperations.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLBulkOperations.cpp rename to ndb/src/old_files/client/odbc/driver/SQLBulkOperations.cpp diff --git a/ndb/src/client/odbc/driver/SQLCancel.cpp b/ndb/src/old_files/client/odbc/driver/SQLCancel.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLCancel.cpp rename to ndb/src/old_files/client/odbc/driver/SQLCancel.cpp diff --git a/ndb/src/client/odbc/driver/SQLCloseCursor.cpp b/ndb/src/old_files/client/odbc/driver/SQLCloseCursor.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLCloseCursor.cpp rename to ndb/src/old_files/client/odbc/driver/SQLCloseCursor.cpp diff --git a/ndb/src/client/odbc/driver/SQLColAttribute.cpp b/ndb/src/old_files/client/odbc/driver/SQLColAttribute.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLColAttribute.cpp rename to ndb/src/old_files/client/odbc/driver/SQLColAttribute.cpp diff --git a/ndb/src/client/odbc/driver/SQLColAttributes.cpp b/ndb/src/old_files/client/odbc/driver/SQLColAttributes.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLColAttributes.cpp rename to ndb/src/old_files/client/odbc/driver/SQLColAttributes.cpp diff --git a/ndb/src/client/odbc/driver/SQLColumnPrivileges.cpp b/ndb/src/old_files/client/odbc/driver/SQLColumnPrivileges.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLColumnPrivileges.cpp rename to ndb/src/old_files/client/odbc/driver/SQLColumnPrivileges.cpp diff --git a/ndb/src/client/odbc/driver/SQLColumns.cpp b/ndb/src/old_files/client/odbc/driver/SQLColumns.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLColumns.cpp rename to ndb/src/old_files/client/odbc/driver/SQLColumns.cpp diff --git a/ndb/src/client/odbc/driver/SQLConnect.cpp b/ndb/src/old_files/client/odbc/driver/SQLConnect.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLConnect.cpp rename to ndb/src/old_files/client/odbc/driver/SQLConnect.cpp diff --git a/ndb/src/client/odbc/driver/SQLCopyDesc.cpp b/ndb/src/old_files/client/odbc/driver/SQLCopyDesc.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLCopyDesc.cpp rename to ndb/src/old_files/client/odbc/driver/SQLCopyDesc.cpp diff --git a/ndb/src/client/odbc/driver/SQLDataSources.cpp b/ndb/src/old_files/client/odbc/driver/SQLDataSources.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLDataSources.cpp rename to ndb/src/old_files/client/odbc/driver/SQLDataSources.cpp diff --git a/ndb/src/client/odbc/driver/SQLDescribeCol.cpp b/ndb/src/old_files/client/odbc/driver/SQLDescribeCol.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLDescribeCol.cpp rename to ndb/src/old_files/client/odbc/driver/SQLDescribeCol.cpp diff --git a/ndb/src/client/odbc/driver/SQLDescribeParam.cpp b/ndb/src/old_files/client/odbc/driver/SQLDescribeParam.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLDescribeParam.cpp rename to ndb/src/old_files/client/odbc/driver/SQLDescribeParam.cpp diff --git a/ndb/src/client/odbc/driver/SQLDisconnect.cpp b/ndb/src/old_files/client/odbc/driver/SQLDisconnect.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLDisconnect.cpp rename to ndb/src/old_files/client/odbc/driver/SQLDisconnect.cpp diff --git a/ndb/src/client/odbc/driver/SQLDriverConnect.cpp b/ndb/src/old_files/client/odbc/driver/SQLDriverConnect.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLDriverConnect.cpp rename to ndb/src/old_files/client/odbc/driver/SQLDriverConnect.cpp diff --git a/ndb/src/client/odbc/driver/SQLDrivers.cpp b/ndb/src/old_files/client/odbc/driver/SQLDrivers.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLDrivers.cpp rename to ndb/src/old_files/client/odbc/driver/SQLDrivers.cpp diff --git a/ndb/src/client/odbc/driver/SQLEndTran.cpp b/ndb/src/old_files/client/odbc/driver/SQLEndTran.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLEndTran.cpp rename to ndb/src/old_files/client/odbc/driver/SQLEndTran.cpp diff --git a/ndb/src/client/odbc/driver/SQLError.cpp b/ndb/src/old_files/client/odbc/driver/SQLError.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLError.cpp rename to ndb/src/old_files/client/odbc/driver/SQLError.cpp diff --git a/ndb/src/client/odbc/driver/SQLExecDirect.cpp b/ndb/src/old_files/client/odbc/driver/SQLExecDirect.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLExecDirect.cpp rename to ndb/src/old_files/client/odbc/driver/SQLExecDirect.cpp diff --git a/ndb/src/client/odbc/driver/SQLExecute.cpp b/ndb/src/old_files/client/odbc/driver/SQLExecute.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLExecute.cpp rename to ndb/src/old_files/client/odbc/driver/SQLExecute.cpp diff --git a/ndb/src/client/odbc/driver/SQLExtendedFetch.cpp b/ndb/src/old_files/client/odbc/driver/SQLExtendedFetch.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLExtendedFetch.cpp rename to ndb/src/old_files/client/odbc/driver/SQLExtendedFetch.cpp diff --git a/ndb/src/client/odbc/driver/SQLFetch.cpp b/ndb/src/old_files/client/odbc/driver/SQLFetch.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLFetch.cpp rename to ndb/src/old_files/client/odbc/driver/SQLFetch.cpp diff --git a/ndb/src/client/odbc/driver/SQLFetchScroll.cpp b/ndb/src/old_files/client/odbc/driver/SQLFetchScroll.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLFetchScroll.cpp rename to ndb/src/old_files/client/odbc/driver/SQLFetchScroll.cpp diff --git a/ndb/src/client/odbc/driver/SQLForeignKeys.cpp b/ndb/src/old_files/client/odbc/driver/SQLForeignKeys.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLForeignKeys.cpp rename to ndb/src/old_files/client/odbc/driver/SQLForeignKeys.cpp diff --git a/ndb/src/client/odbc/driver/SQLFreeConnect.cpp b/ndb/src/old_files/client/odbc/driver/SQLFreeConnect.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLFreeConnect.cpp rename to ndb/src/old_files/client/odbc/driver/SQLFreeConnect.cpp diff --git a/ndb/src/client/odbc/driver/SQLFreeEnv.cpp b/ndb/src/old_files/client/odbc/driver/SQLFreeEnv.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLFreeEnv.cpp rename to ndb/src/old_files/client/odbc/driver/SQLFreeEnv.cpp diff --git a/ndb/src/client/odbc/driver/SQLFreeHandle.cpp b/ndb/src/old_files/client/odbc/driver/SQLFreeHandle.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLFreeHandle.cpp rename to ndb/src/old_files/client/odbc/driver/SQLFreeHandle.cpp diff --git a/ndb/src/client/odbc/driver/SQLFreeStmt.cpp b/ndb/src/old_files/client/odbc/driver/SQLFreeStmt.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLFreeStmt.cpp rename to ndb/src/old_files/client/odbc/driver/SQLFreeStmt.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetConnectAttr.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetConnectAttr.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetConnectAttr.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetConnectAttr.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetConnectOption.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetConnectOption.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetConnectOption.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetConnectOption.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetCursorName.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetCursorName.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetCursorName.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetCursorName.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetData.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetData.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetData.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetData.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetDescField.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetDescField.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetDescField.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetDescField.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetDescRec.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetDescRec.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetDescRec.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetDescRec.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetDiagField.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetDiagField.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetDiagField.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetDiagField.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetDiagRec.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetDiagRec.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetDiagRec.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetDiagRec.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetEnvAttr.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetEnvAttr.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetEnvAttr.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetEnvAttr.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetFunctions.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetFunctions.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetFunctions.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetFunctions.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetInfo.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetInfo.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetInfo.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetInfo.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetStmtAttr.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetStmtAttr.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetStmtAttr.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetStmtAttr.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetStmtOption.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetStmtOption.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetStmtOption.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetStmtOption.cpp diff --git a/ndb/src/client/odbc/driver/SQLGetTypeInfo.cpp b/ndb/src/old_files/client/odbc/driver/SQLGetTypeInfo.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLGetTypeInfo.cpp rename to ndb/src/old_files/client/odbc/driver/SQLGetTypeInfo.cpp diff --git a/ndb/src/client/odbc/driver/SQLMoreResults.cpp b/ndb/src/old_files/client/odbc/driver/SQLMoreResults.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLMoreResults.cpp rename to ndb/src/old_files/client/odbc/driver/SQLMoreResults.cpp diff --git a/ndb/src/client/odbc/driver/SQLNativeSql.cpp b/ndb/src/old_files/client/odbc/driver/SQLNativeSql.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLNativeSql.cpp rename to ndb/src/old_files/client/odbc/driver/SQLNativeSql.cpp diff --git a/ndb/src/client/odbc/driver/SQLNumParams.cpp b/ndb/src/old_files/client/odbc/driver/SQLNumParams.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLNumParams.cpp rename to ndb/src/old_files/client/odbc/driver/SQLNumParams.cpp diff --git a/ndb/src/client/odbc/driver/SQLNumResultCols.cpp b/ndb/src/old_files/client/odbc/driver/SQLNumResultCols.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLNumResultCols.cpp rename to ndb/src/old_files/client/odbc/driver/SQLNumResultCols.cpp diff --git a/ndb/src/client/odbc/driver/SQLParamData.cpp b/ndb/src/old_files/client/odbc/driver/SQLParamData.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLParamData.cpp rename to ndb/src/old_files/client/odbc/driver/SQLParamData.cpp diff --git a/ndb/src/client/odbc/driver/SQLParamOptions.cpp b/ndb/src/old_files/client/odbc/driver/SQLParamOptions.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLParamOptions.cpp rename to ndb/src/old_files/client/odbc/driver/SQLParamOptions.cpp diff --git a/ndb/src/client/odbc/driver/SQLPrepare.cpp b/ndb/src/old_files/client/odbc/driver/SQLPrepare.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLPrepare.cpp rename to ndb/src/old_files/client/odbc/driver/SQLPrepare.cpp diff --git a/ndb/src/client/odbc/driver/SQLPrimaryKeys.cpp b/ndb/src/old_files/client/odbc/driver/SQLPrimaryKeys.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLPrimaryKeys.cpp rename to ndb/src/old_files/client/odbc/driver/SQLPrimaryKeys.cpp diff --git a/ndb/src/client/odbc/driver/SQLProcedureColumns.cpp b/ndb/src/old_files/client/odbc/driver/SQLProcedureColumns.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLProcedureColumns.cpp rename to ndb/src/old_files/client/odbc/driver/SQLProcedureColumns.cpp diff --git a/ndb/src/client/odbc/driver/SQLProcedures.cpp b/ndb/src/old_files/client/odbc/driver/SQLProcedures.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLProcedures.cpp rename to ndb/src/old_files/client/odbc/driver/SQLProcedures.cpp diff --git a/ndb/src/client/odbc/driver/SQLPutData.cpp b/ndb/src/old_files/client/odbc/driver/SQLPutData.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLPutData.cpp rename to ndb/src/old_files/client/odbc/driver/SQLPutData.cpp diff --git a/ndb/src/client/odbc/driver/SQLRowCount.cpp b/ndb/src/old_files/client/odbc/driver/SQLRowCount.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLRowCount.cpp rename to ndb/src/old_files/client/odbc/driver/SQLRowCount.cpp diff --git a/ndb/src/client/odbc/driver/SQLSetConnectAttr.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetConnectAttr.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLSetConnectAttr.cpp rename to ndb/src/old_files/client/odbc/driver/SQLSetConnectAttr.cpp diff --git a/ndb/src/client/odbc/driver/SQLSetConnectOption.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetConnectOption.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLSetConnectOption.cpp rename to ndb/src/old_files/client/odbc/driver/SQLSetConnectOption.cpp diff --git a/ndb/src/client/odbc/driver/SQLSetCursorName.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetCursorName.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLSetCursorName.cpp rename to ndb/src/old_files/client/odbc/driver/SQLSetCursorName.cpp diff --git a/ndb/src/client/odbc/driver/SQLSetDescField.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetDescField.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLSetDescField.cpp rename to ndb/src/old_files/client/odbc/driver/SQLSetDescField.cpp diff --git a/ndb/src/client/odbc/driver/SQLSetDescRec.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetDescRec.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLSetDescRec.cpp rename to ndb/src/old_files/client/odbc/driver/SQLSetDescRec.cpp diff --git a/ndb/src/client/odbc/driver/SQLSetEnvAttr.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetEnvAttr.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLSetEnvAttr.cpp rename to ndb/src/old_files/client/odbc/driver/SQLSetEnvAttr.cpp diff --git a/ndb/src/client/odbc/driver/SQLSetParam.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetParam.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLSetParam.cpp rename to ndb/src/old_files/client/odbc/driver/SQLSetParam.cpp diff --git a/ndb/src/client/odbc/driver/SQLSetPos.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetPos.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLSetPos.cpp rename to ndb/src/old_files/client/odbc/driver/SQLSetPos.cpp diff --git a/ndb/src/client/odbc/driver/SQLSetScrollOptions.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetScrollOptions.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLSetScrollOptions.cpp rename to ndb/src/old_files/client/odbc/driver/SQLSetScrollOptions.cpp diff --git a/ndb/src/client/odbc/driver/SQLSetStmtAttr.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetStmtAttr.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLSetStmtAttr.cpp rename to ndb/src/old_files/client/odbc/driver/SQLSetStmtAttr.cpp diff --git a/ndb/src/client/odbc/driver/SQLSetStmtOption.cpp b/ndb/src/old_files/client/odbc/driver/SQLSetStmtOption.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLSetStmtOption.cpp rename to ndb/src/old_files/client/odbc/driver/SQLSetStmtOption.cpp diff --git a/ndb/src/client/odbc/driver/SQLSpecialColumns.cpp b/ndb/src/old_files/client/odbc/driver/SQLSpecialColumns.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLSpecialColumns.cpp rename to ndb/src/old_files/client/odbc/driver/SQLSpecialColumns.cpp diff --git a/ndb/src/client/odbc/driver/SQLStatistics.cpp b/ndb/src/old_files/client/odbc/driver/SQLStatistics.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLStatistics.cpp rename to ndb/src/old_files/client/odbc/driver/SQLStatistics.cpp diff --git a/ndb/src/client/odbc/driver/SQLTablePrivileges.cpp b/ndb/src/old_files/client/odbc/driver/SQLTablePrivileges.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLTablePrivileges.cpp rename to ndb/src/old_files/client/odbc/driver/SQLTablePrivileges.cpp diff --git a/ndb/src/client/odbc/driver/SQLTables.cpp b/ndb/src/old_files/client/odbc/driver/SQLTables.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLTables.cpp rename to ndb/src/old_files/client/odbc/driver/SQLTables.cpp diff --git a/ndb/src/client/odbc/driver/SQLTransact.cpp b/ndb/src/old_files/client/odbc/driver/SQLTransact.cpp similarity index 100% rename from ndb/src/client/odbc/driver/SQLTransact.cpp rename to ndb/src/old_files/client/odbc/driver/SQLTransact.cpp diff --git a/ndb/src/client/odbc/driver/driver.cpp b/ndb/src/old_files/client/odbc/driver/driver.cpp similarity index 100% rename from ndb/src/client/odbc/driver/driver.cpp rename to ndb/src/old_files/client/odbc/driver/driver.cpp diff --git a/ndb/src/client/odbc/driver/driver.hpp b/ndb/src/old_files/client/odbc/driver/driver.hpp similarity index 100% rename from ndb/src/client/odbc/driver/driver.hpp rename to ndb/src/old_files/client/odbc/driver/driver.hpp diff --git a/ndb/src/client/odbc/executor/Exec_comp_op.cpp b/ndb/src/old_files/client/odbc/executor/Exec_comp_op.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_comp_op.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_comp_op.cpp diff --git a/ndb/src/client/odbc/executor/Exec_create_index.cpp b/ndb/src/old_files/client/odbc/executor/Exec_create_index.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_create_index.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_create_index.cpp diff --git a/ndb/src/client/odbc/executor/Exec_create_table.cpp b/ndb/src/old_files/client/odbc/executor/Exec_create_table.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_create_table.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_create_table.cpp diff --git a/ndb/src/client/odbc/executor/Exec_delete_index.cpp b/ndb/src/old_files/client/odbc/executor/Exec_delete_index.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_delete_index.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_delete_index.cpp diff --git a/ndb/src/client/odbc/executor/Exec_delete_lookup.cpp b/ndb/src/old_files/client/odbc/executor/Exec_delete_lookup.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_delete_lookup.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_delete_lookup.cpp diff --git a/ndb/src/client/odbc/executor/Exec_delete_scan.cpp b/ndb/src/old_files/client/odbc/executor/Exec_delete_scan.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_delete_scan.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_delete_scan.cpp diff --git a/ndb/src/client/odbc/executor/Exec_drop_index.cpp b/ndb/src/old_files/client/odbc/executor/Exec_drop_index.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_drop_index.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_drop_index.cpp diff --git a/ndb/src/client/odbc/executor/Exec_drop_table.cpp b/ndb/src/old_files/client/odbc/executor/Exec_drop_table.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_drop_table.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_drop_table.cpp diff --git a/ndb/src/client/odbc/executor/Exec_expr_conv.cpp b/ndb/src/old_files/client/odbc/executor/Exec_expr_conv.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_expr_conv.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_expr_conv.cpp diff --git a/ndb/src/client/odbc/executor/Exec_expr_func.cpp b/ndb/src/old_files/client/odbc/executor/Exec_expr_func.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_expr_func.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_expr_func.cpp diff --git a/ndb/src/client/odbc/executor/Exec_expr_op.cpp b/ndb/src/old_files/client/odbc/executor/Exec_expr_op.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_expr_op.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_expr_op.cpp diff --git a/ndb/src/client/odbc/executor/Exec_insert.cpp b/ndb/src/old_files/client/odbc/executor/Exec_insert.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_insert.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_insert.cpp diff --git a/ndb/src/client/odbc/executor/Exec_pred_op.cpp b/ndb/src/old_files/client/odbc/executor/Exec_pred_op.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_pred_op.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_pred_op.cpp diff --git a/ndb/src/client/odbc/executor/Exec_query_index.cpp b/ndb/src/old_files/client/odbc/executor/Exec_query_index.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_query_index.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_query_index.cpp diff --git a/ndb/src/client/odbc/executor/Exec_query_lookup.cpp b/ndb/src/old_files/client/odbc/executor/Exec_query_lookup.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_query_lookup.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_query_lookup.cpp diff --git a/ndb/src/client/odbc/executor/Exec_query_range.cpp b/ndb/src/old_files/client/odbc/executor/Exec_query_range.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_query_range.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_query_range.cpp diff --git a/ndb/src/client/odbc/executor/Exec_query_scan.cpp b/ndb/src/old_files/client/odbc/executor/Exec_query_scan.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_query_scan.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_query_scan.cpp diff --git a/ndb/src/client/odbc/executor/Exec_query_sys.cpp b/ndb/src/old_files/client/odbc/executor/Exec_query_sys.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_query_sys.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_query_sys.cpp diff --git a/ndb/src/client/odbc/executor/Exec_update_index.cpp b/ndb/src/old_files/client/odbc/executor/Exec_update_index.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_update_index.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_update_index.cpp diff --git a/ndb/src/client/odbc/executor/Exec_update_lookup.cpp b/ndb/src/old_files/client/odbc/executor/Exec_update_lookup.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_update_lookup.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_update_lookup.cpp diff --git a/ndb/src/client/odbc/executor/Exec_update_scan.cpp b/ndb/src/old_files/client/odbc/executor/Exec_update_scan.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Exec_update_scan.cpp rename to ndb/src/old_files/client/odbc/executor/Exec_update_scan.cpp diff --git a/ndb/src/client/odbc/executor/Executor.cpp b/ndb/src/old_files/client/odbc/executor/Executor.cpp similarity index 100% rename from ndb/src/client/odbc/executor/Executor.cpp rename to ndb/src/old_files/client/odbc/executor/Executor.cpp diff --git a/ndb/src/client/odbc/executor/Executor.hpp b/ndb/src/old_files/client/odbc/executor/Executor.hpp similarity index 100% rename from ndb/src/client/odbc/executor/Executor.hpp rename to ndb/src/old_files/client/odbc/executor/Executor.hpp diff --git a/ndb/src/client/odbc/executor/Makefile b/ndb/src/old_files/client/odbc/executor/Makefile similarity index 100% rename from ndb/src/client/odbc/executor/Makefile rename to ndb/src/old_files/client/odbc/executor/Makefile diff --git a/ndb/src/client/odbc/handles/AttrDbc.cpp b/ndb/src/old_files/client/odbc/handles/AttrDbc.cpp similarity index 100% rename from ndb/src/client/odbc/handles/AttrDbc.cpp rename to ndb/src/old_files/client/odbc/handles/AttrDbc.cpp diff --git a/ndb/src/client/odbc/handles/AttrEnv.cpp b/ndb/src/old_files/client/odbc/handles/AttrEnv.cpp similarity index 100% rename from ndb/src/client/odbc/handles/AttrEnv.cpp rename to ndb/src/old_files/client/odbc/handles/AttrEnv.cpp diff --git a/ndb/src/client/odbc/handles/AttrRoot.cpp b/ndb/src/old_files/client/odbc/handles/AttrRoot.cpp similarity index 100% rename from ndb/src/client/odbc/handles/AttrRoot.cpp rename to ndb/src/old_files/client/odbc/handles/AttrRoot.cpp diff --git a/ndb/src/client/odbc/handles/AttrStmt.cpp b/ndb/src/old_files/client/odbc/handles/AttrStmt.cpp similarity index 100% rename from ndb/src/client/odbc/handles/AttrStmt.cpp rename to ndb/src/old_files/client/odbc/handles/AttrStmt.cpp diff --git a/ndb/src/client/odbc/handles/DescSpec.cpp b/ndb/src/old_files/client/odbc/handles/DescSpec.cpp similarity index 100% rename from ndb/src/client/odbc/handles/DescSpec.cpp rename to ndb/src/old_files/client/odbc/handles/DescSpec.cpp diff --git a/ndb/src/client/odbc/handles/FuncTab.cpp b/ndb/src/old_files/client/odbc/handles/FuncTab.cpp similarity index 100% rename from ndb/src/client/odbc/handles/FuncTab.cpp rename to ndb/src/old_files/client/odbc/handles/FuncTab.cpp diff --git a/ndb/src/client/odbc/handles/HandleBase.cpp b/ndb/src/old_files/client/odbc/handles/HandleBase.cpp similarity index 100% rename from ndb/src/client/odbc/handles/HandleBase.cpp rename to ndb/src/old_files/client/odbc/handles/HandleBase.cpp diff --git a/ndb/src/client/odbc/handles/HandleBase.hpp b/ndb/src/old_files/client/odbc/handles/HandleBase.hpp similarity index 100% rename from ndb/src/client/odbc/handles/HandleBase.hpp rename to ndb/src/old_files/client/odbc/handles/HandleBase.hpp diff --git a/ndb/src/client/odbc/handles/HandleDbc.cpp b/ndb/src/old_files/client/odbc/handles/HandleDbc.cpp similarity index 100% rename from ndb/src/client/odbc/handles/HandleDbc.cpp rename to ndb/src/old_files/client/odbc/handles/HandleDbc.cpp diff --git a/ndb/src/client/odbc/handles/HandleDbc.hpp b/ndb/src/old_files/client/odbc/handles/HandleDbc.hpp similarity index 100% rename from ndb/src/client/odbc/handles/HandleDbc.hpp rename to ndb/src/old_files/client/odbc/handles/HandleDbc.hpp diff --git a/ndb/src/client/odbc/handles/HandleDesc.cpp b/ndb/src/old_files/client/odbc/handles/HandleDesc.cpp similarity index 100% rename from ndb/src/client/odbc/handles/HandleDesc.cpp rename to ndb/src/old_files/client/odbc/handles/HandleDesc.cpp diff --git a/ndb/src/client/odbc/handles/HandleDesc.hpp b/ndb/src/old_files/client/odbc/handles/HandleDesc.hpp similarity index 100% rename from ndb/src/client/odbc/handles/HandleDesc.hpp rename to ndb/src/old_files/client/odbc/handles/HandleDesc.hpp diff --git a/ndb/src/client/odbc/handles/HandleEnv.cpp b/ndb/src/old_files/client/odbc/handles/HandleEnv.cpp similarity index 100% rename from ndb/src/client/odbc/handles/HandleEnv.cpp rename to ndb/src/old_files/client/odbc/handles/HandleEnv.cpp diff --git a/ndb/src/client/odbc/handles/HandleEnv.hpp b/ndb/src/old_files/client/odbc/handles/HandleEnv.hpp similarity index 100% rename from ndb/src/client/odbc/handles/HandleEnv.hpp rename to ndb/src/old_files/client/odbc/handles/HandleEnv.hpp diff --git a/ndb/src/client/odbc/handles/HandleRoot.cpp b/ndb/src/old_files/client/odbc/handles/HandleRoot.cpp similarity index 100% rename from ndb/src/client/odbc/handles/HandleRoot.cpp rename to ndb/src/old_files/client/odbc/handles/HandleRoot.cpp diff --git a/ndb/src/client/odbc/handles/HandleRoot.hpp b/ndb/src/old_files/client/odbc/handles/HandleRoot.hpp similarity index 100% rename from ndb/src/client/odbc/handles/HandleRoot.hpp rename to ndb/src/old_files/client/odbc/handles/HandleRoot.hpp diff --git a/ndb/src/client/odbc/handles/HandleStmt.cpp b/ndb/src/old_files/client/odbc/handles/HandleStmt.cpp similarity index 100% rename from ndb/src/client/odbc/handles/HandleStmt.cpp rename to ndb/src/old_files/client/odbc/handles/HandleStmt.cpp diff --git a/ndb/src/client/odbc/handles/HandleStmt.hpp b/ndb/src/old_files/client/odbc/handles/HandleStmt.hpp similarity index 100% rename from ndb/src/client/odbc/handles/HandleStmt.hpp rename to ndb/src/old_files/client/odbc/handles/HandleStmt.hpp diff --git a/ndb/src/client/odbc/handles/InfoTab.cpp b/ndb/src/old_files/client/odbc/handles/InfoTab.cpp similarity index 100% rename from ndb/src/client/odbc/handles/InfoTab.cpp rename to ndb/src/old_files/client/odbc/handles/InfoTab.cpp diff --git a/ndb/src/client/odbc/handles/Makefile b/ndb/src/old_files/client/odbc/handles/Makefile similarity index 100% rename from ndb/src/client/odbc/handles/Makefile rename to ndb/src/old_files/client/odbc/handles/Makefile diff --git a/ndb/src/client/odbc/handles/PoolNdb.cpp b/ndb/src/old_files/client/odbc/handles/PoolNdb.cpp similarity index 100% rename from ndb/src/client/odbc/handles/PoolNdb.cpp rename to ndb/src/old_files/client/odbc/handles/PoolNdb.cpp diff --git a/ndb/src/client/odbc/handles/PoolNdb.hpp b/ndb/src/old_files/client/odbc/handles/PoolNdb.hpp similarity index 100% rename from ndb/src/client/odbc/handles/PoolNdb.hpp rename to ndb/src/old_files/client/odbc/handles/PoolNdb.hpp diff --git a/ndb/src/client/odbc/handles/handles.hpp b/ndb/src/old_files/client/odbc/handles/handles.hpp similarity index 100% rename from ndb/src/client/odbc/handles/handles.hpp rename to ndb/src/old_files/client/odbc/handles/handles.hpp diff --git a/ndb/src/ndbbaseclient/Makefile b/ndb/src/old_files/ndbbaseclient/Makefile similarity index 100% rename from ndb/src/ndbbaseclient/Makefile rename to ndb/src/old_files/ndbbaseclient/Makefile diff --git a/ndb/src/ndbbaseclient/ndbbaseclient_dummy.cpp b/ndb/src/old_files/ndbbaseclient/ndbbaseclient_dummy.cpp similarity index 100% rename from ndb/src/ndbbaseclient/ndbbaseclient_dummy.cpp rename to ndb/src/old_files/ndbbaseclient/ndbbaseclient_dummy.cpp diff --git a/ndb/src/ndbclient/Makefile b/ndb/src/old_files/ndbclient/Makefile similarity index 100% rename from ndb/src/ndbclient/Makefile rename to ndb/src/old_files/ndbclient/Makefile diff --git a/ndb/src/ndbclient/ndbclient_dummy.cpp b/ndb/src/old_files/ndbclient/ndbclient_dummy.cpp similarity index 100% rename from ndb/src/ndbclient/ndbclient_dummy.cpp rename to ndb/src/old_files/ndbclient/ndbclient_dummy.cpp diff --git a/ndb/src/newtonapi/Makefile b/ndb/src/old_files/newtonapi/Makefile similarity index 100% rename from ndb/src/newtonapi/Makefile rename to ndb/src/old_files/newtonapi/Makefile diff --git a/ndb/src/newtonapi/dba_binding.cpp b/ndb/src/old_files/newtonapi/dba_binding.cpp similarity index 100% rename from ndb/src/newtonapi/dba_binding.cpp rename to ndb/src/old_files/newtonapi/dba_binding.cpp diff --git a/ndb/src/newtonapi/dba_bulkread.cpp b/ndb/src/old_files/newtonapi/dba_bulkread.cpp similarity index 100% rename from ndb/src/newtonapi/dba_bulkread.cpp rename to ndb/src/old_files/newtonapi/dba_bulkread.cpp diff --git a/ndb/src/newtonapi/dba_config.cpp b/ndb/src/old_files/newtonapi/dba_config.cpp similarity index 100% rename from ndb/src/newtonapi/dba_config.cpp rename to ndb/src/old_files/newtonapi/dba_config.cpp diff --git a/ndb/src/newtonapi/dba_dac.cpp b/ndb/src/old_files/newtonapi/dba_dac.cpp similarity index 100% rename from ndb/src/newtonapi/dba_dac.cpp rename to ndb/src/old_files/newtonapi/dba_dac.cpp diff --git a/ndb/src/newtonapi/dba_error.cpp b/ndb/src/old_files/newtonapi/dba_error.cpp similarity index 100% rename from ndb/src/newtonapi/dba_error.cpp rename to ndb/src/old_files/newtonapi/dba_error.cpp diff --git a/ndb/src/newtonapi/dba_init.cpp b/ndb/src/old_files/newtonapi/dba_init.cpp similarity index 100% rename from ndb/src/newtonapi/dba_init.cpp rename to ndb/src/old_files/newtonapi/dba_init.cpp diff --git a/ndb/src/newtonapi/dba_internal.hpp b/ndb/src/old_files/newtonapi/dba_internal.hpp similarity index 100% rename from ndb/src/newtonapi/dba_internal.hpp rename to ndb/src/old_files/newtonapi/dba_internal.hpp diff --git a/ndb/src/newtonapi/dba_process.cpp b/ndb/src/old_files/newtonapi/dba_process.cpp similarity index 100% rename from ndb/src/newtonapi/dba_process.cpp rename to ndb/src/old_files/newtonapi/dba_process.cpp diff --git a/ndb/src/newtonapi/dba_process.hpp b/ndb/src/old_files/newtonapi/dba_process.hpp similarity index 100% rename from ndb/src/newtonapi/dba_process.hpp rename to ndb/src/old_files/newtonapi/dba_process.hpp diff --git a/ndb/src/newtonapi/dba_schema.cpp b/ndb/src/old_files/newtonapi/dba_schema.cpp similarity index 100% rename from ndb/src/newtonapi/dba_schema.cpp rename to ndb/src/old_files/newtonapi/dba_schema.cpp diff --git a/ndb/src/rep/ExtSender.cpp b/ndb/src/old_files/rep/ExtSender.cpp similarity index 100% rename from ndb/src/rep/ExtSender.cpp rename to ndb/src/old_files/rep/ExtSender.cpp diff --git a/ndb/src/rep/ExtSender.hpp b/ndb/src/old_files/rep/ExtSender.hpp similarity index 100% rename from ndb/src/rep/ExtSender.hpp rename to ndb/src/old_files/rep/ExtSender.hpp diff --git a/ndb/src/rep/Makefile b/ndb/src/old_files/rep/Makefile similarity index 100% rename from ndb/src/rep/Makefile rename to ndb/src/old_files/rep/Makefile diff --git a/ndb/src/rep/NodeConnectInfo.hpp b/ndb/src/old_files/rep/NodeConnectInfo.hpp similarity index 100% rename from ndb/src/rep/NodeConnectInfo.hpp rename to ndb/src/old_files/rep/NodeConnectInfo.hpp diff --git a/ndb/src/rep/README b/ndb/src/old_files/rep/README similarity index 100% rename from ndb/src/rep/README rename to ndb/src/old_files/rep/README diff --git a/ndb/src/rep/RepApiInterpreter.cpp b/ndb/src/old_files/rep/RepApiInterpreter.cpp similarity index 100% rename from ndb/src/rep/RepApiInterpreter.cpp rename to ndb/src/old_files/rep/RepApiInterpreter.cpp diff --git a/ndb/src/rep/RepApiInterpreter.hpp b/ndb/src/old_files/rep/RepApiInterpreter.hpp similarity index 100% rename from ndb/src/rep/RepApiInterpreter.hpp rename to ndb/src/old_files/rep/RepApiInterpreter.hpp diff --git a/ndb/src/rep/RepApiService.cpp b/ndb/src/old_files/rep/RepApiService.cpp similarity index 100% rename from ndb/src/rep/RepApiService.cpp rename to ndb/src/old_files/rep/RepApiService.cpp diff --git a/ndb/src/rep/RepApiService.hpp b/ndb/src/old_files/rep/RepApiService.hpp similarity index 100% rename from ndb/src/rep/RepApiService.hpp rename to ndb/src/old_files/rep/RepApiService.hpp diff --git a/ndb/src/rep/RepCommandInterpreter.cpp b/ndb/src/old_files/rep/RepCommandInterpreter.cpp similarity index 100% rename from ndb/src/rep/RepCommandInterpreter.cpp rename to ndb/src/old_files/rep/RepCommandInterpreter.cpp diff --git a/ndb/src/rep/RepCommandInterpreter.hpp b/ndb/src/old_files/rep/RepCommandInterpreter.hpp similarity index 100% rename from ndb/src/rep/RepCommandInterpreter.hpp rename to ndb/src/old_files/rep/RepCommandInterpreter.hpp diff --git a/ndb/src/rep/RepComponents.cpp b/ndb/src/old_files/rep/RepComponents.cpp similarity index 100% rename from ndb/src/rep/RepComponents.cpp rename to ndb/src/old_files/rep/RepComponents.cpp diff --git a/ndb/src/rep/RepComponents.hpp b/ndb/src/old_files/rep/RepComponents.hpp similarity index 100% rename from ndb/src/rep/RepComponents.hpp rename to ndb/src/old_files/rep/RepComponents.hpp diff --git a/ndb/src/rep/RepMain.cpp b/ndb/src/old_files/rep/RepMain.cpp similarity index 100% rename from ndb/src/rep/RepMain.cpp rename to ndb/src/old_files/rep/RepMain.cpp diff --git a/ndb/src/rep/Requestor.cpp b/ndb/src/old_files/rep/Requestor.cpp similarity index 100% rename from ndb/src/rep/Requestor.cpp rename to ndb/src/old_files/rep/Requestor.cpp diff --git a/ndb/src/rep/Requestor.hpp b/ndb/src/old_files/rep/Requestor.hpp similarity index 100% rename from ndb/src/rep/Requestor.hpp rename to ndb/src/old_files/rep/Requestor.hpp diff --git a/ndb/src/rep/RequestorSubscriptions.cpp b/ndb/src/old_files/rep/RequestorSubscriptions.cpp similarity index 100% rename from ndb/src/rep/RequestorSubscriptions.cpp rename to ndb/src/old_files/rep/RequestorSubscriptions.cpp diff --git a/ndb/src/rep/SignalQueue.cpp b/ndb/src/old_files/rep/SignalQueue.cpp similarity index 100% rename from ndb/src/rep/SignalQueue.cpp rename to ndb/src/old_files/rep/SignalQueue.cpp diff --git a/ndb/src/rep/SignalQueue.hpp b/ndb/src/old_files/rep/SignalQueue.hpp similarity index 100% rename from ndb/src/rep/SignalQueue.hpp rename to ndb/src/old_files/rep/SignalQueue.hpp diff --git a/ndb/src/rep/TODO b/ndb/src/old_files/rep/TODO similarity index 100% rename from ndb/src/rep/TODO rename to ndb/src/old_files/rep/TODO diff --git a/ndb/src/rep/adapters/AppNDB.cpp b/ndb/src/old_files/rep/adapters/AppNDB.cpp similarity index 100% rename from ndb/src/rep/adapters/AppNDB.cpp rename to ndb/src/old_files/rep/adapters/AppNDB.cpp diff --git a/ndb/src/rep/adapters/AppNDB.hpp b/ndb/src/old_files/rep/adapters/AppNDB.hpp similarity index 100% rename from ndb/src/rep/adapters/AppNDB.hpp rename to ndb/src/old_files/rep/adapters/AppNDB.hpp diff --git a/ndb/src/rep/adapters/ExtAPI.cpp b/ndb/src/old_files/rep/adapters/ExtAPI.cpp similarity index 100% rename from ndb/src/rep/adapters/ExtAPI.cpp rename to ndb/src/old_files/rep/adapters/ExtAPI.cpp diff --git a/ndb/src/rep/adapters/ExtAPI.hpp b/ndb/src/old_files/rep/adapters/ExtAPI.hpp similarity index 100% rename from ndb/src/rep/adapters/ExtAPI.hpp rename to ndb/src/old_files/rep/adapters/ExtAPI.hpp diff --git a/ndb/src/rep/adapters/ExtNDB.cpp b/ndb/src/old_files/rep/adapters/ExtNDB.cpp similarity index 100% rename from ndb/src/rep/adapters/ExtNDB.cpp rename to ndb/src/old_files/rep/adapters/ExtNDB.cpp diff --git a/ndb/src/rep/adapters/ExtNDB.hpp b/ndb/src/old_files/rep/adapters/ExtNDB.hpp similarity index 100% rename from ndb/src/rep/adapters/ExtNDB.hpp rename to ndb/src/old_files/rep/adapters/ExtNDB.hpp diff --git a/ndb/src/rep/adapters/Makefile b/ndb/src/old_files/rep/adapters/Makefile similarity index 100% rename from ndb/src/rep/adapters/Makefile rename to ndb/src/old_files/rep/adapters/Makefile diff --git a/ndb/src/rep/adapters/TableInfoPs.hpp b/ndb/src/old_files/rep/adapters/TableInfoPs.hpp similarity index 100% rename from ndb/src/rep/adapters/TableInfoPs.hpp rename to ndb/src/old_files/rep/adapters/TableInfoPs.hpp diff --git a/ndb/src/rep/dbug_hack.cpp b/ndb/src/old_files/rep/dbug_hack.cpp similarity index 100% rename from ndb/src/rep/dbug_hack.cpp rename to ndb/src/old_files/rep/dbug_hack.cpp diff --git a/ndb/src/rep/rep_version.hpp b/ndb/src/old_files/rep/rep_version.hpp similarity index 100% rename from ndb/src/rep/rep_version.hpp rename to ndb/src/old_files/rep/rep_version.hpp diff --git a/ndb/src/rep/repapi/Makefile b/ndb/src/old_files/rep/repapi/Makefile similarity index 100% rename from ndb/src/rep/repapi/Makefile rename to ndb/src/old_files/rep/repapi/Makefile diff --git a/ndb/src/rep/repapi/repapi.cpp b/ndb/src/old_files/rep/repapi/repapi.cpp similarity index 100% rename from ndb/src/rep/repapi/repapi.cpp rename to ndb/src/old_files/rep/repapi/repapi.cpp diff --git a/ndb/src/rep/repapi/repapi.h b/ndb/src/old_files/rep/repapi/repapi.h similarity index 100% rename from ndb/src/rep/repapi/repapi.h rename to ndb/src/old_files/rep/repapi/repapi.h diff --git a/ndb/src/rep/state/Channel.cpp b/ndb/src/old_files/rep/state/Channel.cpp similarity index 100% rename from ndb/src/rep/state/Channel.cpp rename to ndb/src/old_files/rep/state/Channel.cpp diff --git a/ndb/src/rep/state/Channel.hpp b/ndb/src/old_files/rep/state/Channel.hpp similarity index 100% rename from ndb/src/rep/state/Channel.hpp rename to ndb/src/old_files/rep/state/Channel.hpp diff --git a/ndb/src/rep/state/Interval.cpp b/ndb/src/old_files/rep/state/Interval.cpp similarity index 100% rename from ndb/src/rep/state/Interval.cpp rename to ndb/src/old_files/rep/state/Interval.cpp diff --git a/ndb/src/rep/state/Interval.hpp b/ndb/src/old_files/rep/state/Interval.hpp similarity index 100% rename from ndb/src/rep/state/Interval.hpp rename to ndb/src/old_files/rep/state/Interval.hpp diff --git a/ndb/src/rep/state/Makefile b/ndb/src/old_files/rep/state/Makefile similarity index 100% rename from ndb/src/rep/state/Makefile rename to ndb/src/old_files/rep/state/Makefile diff --git a/ndb/src/rep/state/RepState.cpp b/ndb/src/old_files/rep/state/RepState.cpp similarity index 100% rename from ndb/src/rep/state/RepState.cpp rename to ndb/src/old_files/rep/state/RepState.cpp diff --git a/ndb/src/rep/state/RepState.hpp b/ndb/src/old_files/rep/state/RepState.hpp similarity index 100% rename from ndb/src/rep/state/RepState.hpp rename to ndb/src/old_files/rep/state/RepState.hpp diff --git a/ndb/src/rep/state/RepStateEvent.cpp b/ndb/src/old_files/rep/state/RepStateEvent.cpp similarity index 100% rename from ndb/src/rep/state/RepStateEvent.cpp rename to ndb/src/old_files/rep/state/RepStateEvent.cpp diff --git a/ndb/src/rep/state/RepStateRequests.cpp b/ndb/src/old_files/rep/state/RepStateRequests.cpp similarity index 100% rename from ndb/src/rep/state/RepStateRequests.cpp rename to ndb/src/old_files/rep/state/RepStateRequests.cpp diff --git a/ndb/src/rep/state/testInterval/Makefile b/ndb/src/old_files/rep/state/testInterval/Makefile similarity index 100% rename from ndb/src/rep/state/testInterval/Makefile rename to ndb/src/old_files/rep/state/testInterval/Makefile diff --git a/ndb/src/rep/state/testInterval/testInterval.cpp b/ndb/src/old_files/rep/state/testInterval/testInterval.cpp similarity index 100% rename from ndb/src/rep/state/testInterval/testInterval.cpp rename to ndb/src/old_files/rep/state/testInterval/testInterval.cpp diff --git a/ndb/src/rep/state/testRepState/Makefile b/ndb/src/old_files/rep/state/testRepState/Makefile similarity index 100% rename from ndb/src/rep/state/testRepState/Makefile rename to ndb/src/old_files/rep/state/testRepState/Makefile diff --git a/ndb/src/rep/state/testRepState/testRequestor.cpp b/ndb/src/old_files/rep/state/testRepState/testRequestor.cpp similarity index 100% rename from ndb/src/rep/state/testRepState/testRequestor.cpp rename to ndb/src/old_files/rep/state/testRepState/testRequestor.cpp diff --git a/ndb/src/rep/state/testRepState/testRequestor.hpp b/ndb/src/old_files/rep/state/testRepState/testRequestor.hpp similarity index 100% rename from ndb/src/rep/state/testRepState/testRequestor.hpp rename to ndb/src/old_files/rep/state/testRepState/testRequestor.hpp diff --git a/ndb/src/rep/storage/GCIBuffer.cpp b/ndb/src/old_files/rep/storage/GCIBuffer.cpp similarity index 100% rename from ndb/src/rep/storage/GCIBuffer.cpp rename to ndb/src/old_files/rep/storage/GCIBuffer.cpp diff --git a/ndb/src/rep/storage/GCIBuffer.hpp b/ndb/src/old_files/rep/storage/GCIBuffer.hpp similarity index 100% rename from ndb/src/rep/storage/GCIBuffer.hpp rename to ndb/src/old_files/rep/storage/GCIBuffer.hpp diff --git a/ndb/src/rep/storage/GCIContainer.cpp b/ndb/src/old_files/rep/storage/GCIContainer.cpp similarity index 100% rename from ndb/src/rep/storage/GCIContainer.cpp rename to ndb/src/old_files/rep/storage/GCIContainer.cpp diff --git a/ndb/src/rep/storage/GCIContainer.hpp b/ndb/src/old_files/rep/storage/GCIContainer.hpp similarity index 100% rename from ndb/src/rep/storage/GCIContainer.hpp rename to ndb/src/old_files/rep/storage/GCIContainer.hpp diff --git a/ndb/src/rep/storage/GCIContainerPS.cpp b/ndb/src/old_files/rep/storage/GCIContainerPS.cpp similarity index 100% rename from ndb/src/rep/storage/GCIContainerPS.cpp rename to ndb/src/old_files/rep/storage/GCIContainerPS.cpp diff --git a/ndb/src/rep/storage/GCIContainerPS.hpp b/ndb/src/old_files/rep/storage/GCIContainerPS.hpp similarity index 100% rename from ndb/src/rep/storage/GCIContainerPS.hpp rename to ndb/src/old_files/rep/storage/GCIContainerPS.hpp diff --git a/ndb/src/rep/storage/GCIPage.cpp b/ndb/src/old_files/rep/storage/GCIPage.cpp similarity index 100% rename from ndb/src/rep/storage/GCIPage.cpp rename to ndb/src/old_files/rep/storage/GCIPage.cpp diff --git a/ndb/src/rep/storage/GCIPage.hpp b/ndb/src/old_files/rep/storage/GCIPage.hpp similarity index 100% rename from ndb/src/rep/storage/GCIPage.hpp rename to ndb/src/old_files/rep/storage/GCIPage.hpp diff --git a/ndb/src/rep/storage/LogRecord.hpp b/ndb/src/old_files/rep/storage/LogRecord.hpp similarity index 100% rename from ndb/src/rep/storage/LogRecord.hpp rename to ndb/src/old_files/rep/storage/LogRecord.hpp diff --git a/ndb/src/rep/storage/Makefile b/ndb/src/old_files/rep/storage/Makefile similarity index 100% rename from ndb/src/rep/storage/Makefile rename to ndb/src/old_files/rep/storage/Makefile diff --git a/ndb/src/rep/storage/NodeConnectInfo.hpp b/ndb/src/old_files/rep/storage/NodeConnectInfo.hpp similarity index 100% rename from ndb/src/rep/storage/NodeConnectInfo.hpp rename to ndb/src/old_files/rep/storage/NodeConnectInfo.hpp diff --git a/ndb/src/rep/storage/NodeGroup.cpp b/ndb/src/old_files/rep/storage/NodeGroup.cpp similarity index 100% rename from ndb/src/rep/storage/NodeGroup.cpp rename to ndb/src/old_files/rep/storage/NodeGroup.cpp diff --git a/ndb/src/rep/storage/NodeGroup.hpp b/ndb/src/old_files/rep/storage/NodeGroup.hpp similarity index 100% rename from ndb/src/rep/storage/NodeGroup.hpp rename to ndb/src/old_files/rep/storage/NodeGroup.hpp diff --git a/ndb/src/rep/storage/NodeGroupInfo.cpp b/ndb/src/old_files/rep/storage/NodeGroupInfo.cpp similarity index 100% rename from ndb/src/rep/storage/NodeGroupInfo.cpp rename to ndb/src/old_files/rep/storage/NodeGroupInfo.cpp diff --git a/ndb/src/rep/storage/NodeGroupInfo.hpp b/ndb/src/old_files/rep/storage/NodeGroupInfo.hpp similarity index 100% rename from ndb/src/rep/storage/NodeGroupInfo.hpp rename to ndb/src/old_files/rep/storage/NodeGroupInfo.hpp diff --git a/ndb/src/rep/transfer/Makefile b/ndb/src/old_files/rep/transfer/Makefile similarity index 100% rename from ndb/src/rep/transfer/Makefile rename to ndb/src/old_files/rep/transfer/Makefile diff --git a/ndb/src/rep/transfer/TransPS.cpp b/ndb/src/old_files/rep/transfer/TransPS.cpp similarity index 100% rename from ndb/src/rep/transfer/TransPS.cpp rename to ndb/src/old_files/rep/transfer/TransPS.cpp diff --git a/ndb/src/rep/transfer/TransPS.hpp b/ndb/src/old_files/rep/transfer/TransPS.hpp similarity index 100% rename from ndb/src/rep/transfer/TransPS.hpp rename to ndb/src/old_files/rep/transfer/TransPS.hpp diff --git a/ndb/src/rep/transfer/TransSS.cpp b/ndb/src/old_files/rep/transfer/TransSS.cpp similarity index 100% rename from ndb/src/rep/transfer/TransSS.cpp rename to ndb/src/old_files/rep/transfer/TransSS.cpp diff --git a/ndb/src/rep/transfer/TransSS.hpp b/ndb/src/old_files/rep/transfer/TransSS.hpp similarity index 100% rename from ndb/src/rep/transfer/TransSS.hpp rename to ndb/src/old_files/rep/transfer/TransSS.hpp diff --git a/ndb/src/rep/transfer/TransSSSubscriptions.cpp b/ndb/src/old_files/rep/transfer/TransSSSubscriptions.cpp similarity index 100% rename from ndb/src/rep/transfer/TransSSSubscriptions.cpp rename to ndb/src/old_files/rep/transfer/TransSSSubscriptions.cpp diff --git a/ndb/src/scripts/Makefile b/ndb/src/scripts/Makefile deleted file mode 100644 index bc8049ac34b..00000000000 --- a/ndb/src/scripts/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -include .defs.mk - -DIRS := - -include $(NDB_TOP)/Epilogue.mk diff --git a/ndb/test/Makefile.am b/ndb/test/Makefile.am index cecbd0b8717..2e0f30df9d4 100644 --- a/ndb/test/Makefile.am +++ b/ndb/test/Makefile.am @@ -1 +1,6 @@ SUBDIRS = src tools ndbapi run-test + +EXTRA_DIST = include + +dist-hook: + -rm -rf `find $(distdir) -type d -name SCCS` diff --git a/ndb/test/Makefile_old b/ndb/test/Makefile_old deleted file mode 100644 index 19472917560..00000000000 --- a/ndb/test/Makefile_old +++ /dev/null @@ -1,19 +0,0 @@ -include .defs.mk - -DIRS := src tools ndbapi run-test - -EXTRA_DIRS = newtonapi - -ifeq ($(NDB_ARCH), x86_64) -EXTRA_DIRS = -endif - -DIRS += $(EXTRA_DIRS) - -ifneq ($(NDB_ODBC),N) -DIRS += odbc -endif - -include $(NDB_TOP)/Epilogue.mk - -_bins_ndbapi : _libs_src diff --git a/ndb/include/ndbapi/NdbSchemaCon.hpp b/ndb/test/include/NdbSchemaCon.hpp similarity index 100% rename from ndb/include/ndbapi/NdbSchemaCon.hpp rename to ndb/test/include/NdbSchemaCon.hpp diff --git a/ndb/include/ndbapi/NdbSchemaOp.hpp b/ndb/test/include/NdbSchemaOp.hpp similarity index 100% rename from ndb/include/ndbapi/NdbSchemaOp.hpp rename to ndb/test/include/NdbSchemaOp.hpp diff --git a/ndb/test/newtonapi/Makefile b/ndb/test/newtonapi/Makefile deleted file mode 100644 index e3eabd26c64..00000000000 --- a/ndb/test/newtonapi/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include .defs.mk - -DIRS := \ - basic_test \ - perf_test - -include $(NDB_TOP)/Epilogue.mk - diff --git a/ndb/test/odbc/Makefile b/ndb/test/odbc/Makefile deleted file mode 100644 index eb9f2dc9e3e..00000000000 --- a/ndb/test/odbc/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -include .defs.mk - -DIRS += driver - -#ifneq ($(findstring odbc, $(wildcard /usr/lib/libodbc.so)),) -#DIRS += dm-unixodbc -#endif - -ifneq ($(findstring $(NDB_OS), SOLARIS),) -DIRS += dm-iodbc -endif - -include ${NDB_TOP}/Epilogue.mk diff --git a/ndb/test/run-test/Makefile.am b/ndb/test/run-test/Makefile.am index 205c315cb04..3dd9632ce4b 100644 --- a/ndb/test/run-test/Makefile.am +++ b/ndb/test/run-test/Makefile.am @@ -4,10 +4,11 @@ ndbtest_PROGRAMS = atrt atrt_SOURCES = main.cpp ndbtest_SCRIPTS = atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \ - atrt-clear-result.sh make-config.sh + atrt-clear-result.sh make-config.sh make-index.sh make-html-reports.sh +EXTRA_DIST = $(ndbtest_SCRIPTS) INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmclient -LDADD_LOC = $(top_srcdir)/ndb/src/mgmclient/CpcClient.o $(top_srcdir)/ndb/src/libndbclient.la +LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CpcClient.o $(top_builddir)/ndb/src/libndbclient.la include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_util.mk.am diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp index eb8a626dc2b..8bdab14d9c2 100644 --- a/ndb/test/run-test/main.cpp +++ b/ndb/test/run-test/main.cpp @@ -158,10 +158,17 @@ main(int argc, const char ** argv){ if(!start_processes(g_config, atrt_process::NDB_DB)) goto end; - - if(!wait_ndb(g_config, NDB_MGM_NODE_STATUS_STARTED)) - goto end; - + + if(!wait_ndb(g_config, NDB_MGM_NODE_STATUS_NOT_STARTED)) + goto end; + + for(Uint32 i = 0; i<3; i++) + if(wait_ndb(g_config, NDB_MGM_NODE_STATUS_STARTED)) + goto started; + + goto end; + +started: g_logger.info("Ndb start completed"); } @@ -347,7 +354,7 @@ parse_args(int argc, const char** argv){ return false; } - g_default_user = strdup(getenv("USER")); + g_default_user = strdup(getenv("LOGNAME")); return true; } @@ -377,6 +384,7 @@ setup_config(atrt_config& config){ int lineno = 0; char buf[2048]; + BaseString connect_string; while(fgets(buf, 2048, f)){ lineno++; @@ -449,8 +457,10 @@ setup_config(atrt_config& config){ for(size_t i = 0; im_base_dir; const int index = config.m_processes.size() + 1; + atrt_process proc; proc.m_index = index; proc.m_host = host; @@ -458,8 +468,8 @@ setup_config(atrt_config& config){ proc.m_proc.m_type = "temporary"; proc.m_proc.m_owner = "atrt"; proc.m_proc.m_group = "group"; - proc.m_proc.m_cwd.assign(host->m_base_dir).append("/run/"); - proc.m_proc.m_env.assign("LD_LIBRARY_PATH=").append(host->m_base_dir).append("/lib"); + proc.m_proc.m_cwd.assign(dir).append("/run/"); + proc.m_proc.m_env.assfmt("LD_LIBRARY_PATH=%s/lib/mysql", dir.c_str()); proc.m_proc.m_stdout = "log.out"; proc.m_proc.m_stderr = "2>&1"; proc.m_proc.m_runas = proc.m_host->m_user; @@ -468,16 +478,18 @@ setup_config(atrt_config& config){ proc.m_ndb_mgm_port = g_default_base_port; if(split1[0] == "mgm"){ proc.m_type = atrt_process::NDB_MGM; - proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_mgm"); - proc.m_proc.m_path.assign(host->m_base_dir).append("/bin/mgmtsrvr"); + proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_mgmd"); + proc.m_proc.m_path.assign(dir).append("/libexec/ndb_mgmd"); proc.m_proc.m_args = "-n -c initconfig.txt"; - proc.m_proc.m_cwd.appfmt("%d.ndb_mgm", index); + proc.m_proc.m_cwd.appfmt("%d.ndb_mgmd", index); + connect_string.appfmt(";host=%s:%d", + proc.m_hostname.c_str(), proc.m_ndb_mgm_port); } else if(split1[0] == "ndb"){ proc.m_type = atrt_process::NDB_DB; - proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_db"); - proc.m_proc.m_path.assign(host->m_base_dir).append("/bin/ndb"); + proc.m_proc.m_name.assfmt("%d-%s", index, "ndbd"); + proc.m_proc.m_path.assign(dir).append("/libexec/ndbd"); proc.m_proc.m_args = "-i -n"; - proc.m_proc.m_cwd.appfmt("%d.ndb_db", index); + proc.m_proc.m_cwd.appfmt("%d.ndbd", index); } else if(split1[0] == "api"){ proc.m_type = atrt_process::NDB_API; proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_api"); @@ -494,7 +506,13 @@ setup_config(atrt_config& config){ config.m_processes.push_back(proc); } } - + + // Setup connect string + for(size_t i = 0; inode_states[i].node_id, min, min2, goal); + } } } diff --git a/ndb/test/src/Makefile.am b/ndb/test/src/Makefile.am index d062eeae76c..a513086dc33 100644 --- a/ndb/test/src/Makefile.am +++ b/ndb/test/src/Makefile.am @@ -8,7 +8,8 @@ libNDBT_a_SOURCES = \ HugoOperations.cpp HugoTransactions.cpp \ HugoAsynchTransactions.cpp UtilTransactions.cpp \ NdbRestarter.cpp NdbRestarts.cpp NDBT_Output.cpp \ - NdbBackup.cpp NdbConfig.cpp NdbGrep.cpp NDBT_Table.cpp + NdbBackup.cpp NdbConfig.cpp NdbGrep.cpp NDBT_Table.cpp \ + NdbSchemaCon.cpp NdbSchemaOp.cpp INCLUDES_LOC = -I$(top_srcdir)/ndb/src/common/mgmcommon -I$(top_srcdir)/ndb/include/mgmcommon -I$(top_srcdir)/ndb/include/kernel -I$(top_srcdir)/ndb/src/mgmapi diff --git a/ndb/test/src/NDBT_ResultRow.cpp b/ndb/test/src/NDBT_ResultRow.cpp index 350a9719c2c..7c419444760 100644 --- a/ndb/test/src/NDBT_ResultRow.cpp +++ b/ndb/test/src/NDBT_ResultRow.cpp @@ -110,86 +110,10 @@ BaseString NDBT_ResultRow::c_str() { return str; } - -/** - * TODO This should share the same printer function as in - * NdbEventOperationImpl.cpp, using new types of course :) - */ - NdbOut & operator << (NdbOut& ndbout, const NDBT_ResultRow & res) { - for(int i = 0; iisNULL()) - ndbout << "NULL"; - else{ - const int size = res.data[i]->attrSize(); - const int aSize = res.data[i]->arraySize(); - switch(convertColumnTypeToAttrType(res.data[i]->getType())){ - case UnSigned: - switch(size){ - case 8: - ndbout << res.data[i]->u_64_value(); - break; - case 4: - ndbout << res.data[i]->u_32_value(); - break; - case 2: - ndbout << res.data[i]->u_short_value(); - break; - case 1: - ndbout << (unsigned) res.data[i]->u_char_value(); - break; - default: - ndbout << "Unknown size"; - } - break; - - case Signed: - switch(size){ - case 8: - ndbout << res.data[i]->int64_value(); - break; - case 4: - ndbout << res.data[i]->int32_value(); - break; - case 2: - ndbout << res.data[i]->short_value(); - break; - case 1: - ndbout << (int) res.data[i]->char_value(); - break; - default: - ndbout << "Unknown size"; - } - break; - - case String: - { - char * buf = new char[aSize+1]; - memcpy(buf, res.data[i]->aRef(), aSize); - buf[aSize] = 0; - ndbout << buf; - delete [] buf; - // Null terminate string - //res.data[i][res.sizes[i]] = 0; - //ndbout << res.data[i]; - } - break; - - case Float: - ndbout_c("%f", res.data[i]->float_value()); - break; - - default: - ndbout << "Unknown(" << - convertColumnTypeToAttrType(res.data[i]->getType()) << ")"; - break; - } - } - if (i < res.cols-1) - ndbout << res.ad; - } - + for(int i = 0; i #include #include - class NdbOut& operator <<(class NdbOut& ndbout, const NDBT_Attribute & attr){ NdbDictionary::Column::Type type = attr.getType(); - bool key = attr.getPrimaryKey(); - bool null = attr.getNullable(); - ndbout << attr.getName() << " "; - char tmp[100]; - if(attr.getLength() != 1) - snprintf(tmp, 100," [%d]", attr.getLength()); - else - tmp[0] = 0; + ndbout << attr.getName() << " " << type; switch(type){ - case NdbDictionary::Column::Tinyint: - ndbout << "Tinyint" << tmp; - break; - case NdbDictionary::Column::Tinyunsigned: - ndbout << "Tinyunsigned" << tmp; - break; - case NdbDictionary::Column::Smallint: - ndbout << "Smallint" << tmp; - break; - case NdbDictionary::Column::Smallunsigned: - ndbout << "Smallunsigned" << tmp; - break; - case NdbDictionary::Column::Mediumint: - ndbout << "Mediumint" << tmp; - break; - case NdbDictionary::Column::Mediumunsigned: - ndbout << "Mediumunsigned" << tmp; - break; - case NdbDictionary::Column::Int: - ndbout << "Int" << tmp; - break; - case NdbDictionary::Column::Unsigned: - ndbout << "Unsigned" << tmp; - break; - case NdbDictionary::Column::Bigint: - ndbout << "Bigint" << tmp; - break; - case NdbDictionary::Column::Bigunsigned: - ndbout << "Bigunsigned" << tmp; - break; - case NdbDictionary::Column::Float: - ndbout << "Float" << tmp; - break; - case NdbDictionary::Column::Double: - ndbout << "Double" << tmp; - break; case NdbDictionary::Column::Decimal: - ndbout << "Decimal(" - << attr.getScale() << ", " << attr.getPrecision() << ")" - << tmp; - break; - case NdbDictionary::Column::Char: - ndbout << "Char(" << attr.getLength() << ")"; - break; - case NdbDictionary::Column::Varchar: - ndbout << "Varchar(" << attr.getLength() << ")"; - break; - case NdbDictionary::Column::Binary: - ndbout << "Binary(" << attr.getLength() << ")"; - break; - case NdbDictionary::Column::Varbinary: - ndbout << "Varbinary(" << attr.getLength() << ")"; - break; - case NdbDictionary::Column::Datetime: - ndbout << "Datetime" << tmp; - break; - case NdbDictionary::Column::Timespec: - ndbout << "Timespec" << tmp; - break; - case NdbDictionary::Column::Blob: - ndbout << "Blob" << tmp; - break; - case NdbDictionary::Column::Undefined: - ndbout << "Undefined" << tmp; + ndbout << "(" << attr.getScale() << ", " << attr.getPrecision() << ")"; break; default: - ndbout << "Unknown(" << type << ")"; + break; } - ndbout << " "; - if(null){ - ndbout << "NULL"; - } else { - ndbout << "NOT NULL"; - } - ndbout << " "; + if(attr.getLength() != 1) + ndbout << "[" << attr.getLength() << "]"; + + if(attr.getNullable()) + ndbout << " NULL"; + else + ndbout << " NOT NULL"; - if(key) - ndbout << "PRIMARY KEY"; + if(attr.getPrimaryKey()) + ndbout << " PRIMARY KEY"; return ndbout; } diff --git a/ndb/test/src/NdbBackup.cpp b/ndb/test/src/NdbBackup.cpp index 13dc67748a5..169034e0c07 100644 --- a/ndb/test/src/NdbBackup.cpp +++ b/ndb/test/src/NdbBackup.cpp @@ -90,8 +90,9 @@ NdbBackup::getFileSystemPathForNode(int _node_id){ ndbout << "Invalid configuration fetched, DB missing" << endl; return NULL; } - unsigned int type; - if(!iter.get(CFG_TYPE_OF_SECTION, &type) || type != NODE_TYPE_DB){ + unsigned int type = 123456; + if(iter.get(CFG_TYPE_OF_SECTION, &type) || type != NODE_TYPE_DB){ + ndbout <<"type = " << type << endl; ndbout <<"Invalid configuration fetched, I'm wrong type of node" << endl; return NULL; } @@ -114,10 +115,13 @@ NdbBackup::execRestore(bool _restore_data, const int buf_len = 1000; char buf[buf_len]; + ndbout << "getFileSystemPathForNode "<< _node_id < +#include +#include +#include /********************************************************************* @@ -142,20 +143,22 @@ NdbSchemaCon::release() return; }//NdbSchemaCon::release() +#include +static void +update(const NdbError & _err){ + NdbError & error = (NdbError &) _err; + ndberror_struct ndberror = (ndberror_struct)error; + ndberror_update(&ndberror); + error = NdbError(ndberror); +} - - - - - - - - - - - - +const +NdbError & +NdbSchemaCon::getNdbError() const { + update(theError); + return theError; +} diff --git a/ndb/src/ndbapi/NdbSchemaOp.cpp b/ndb/test/src/NdbSchemaOp.cpp similarity index 98% rename from ndb/src/ndbapi/NdbSchemaOp.cpp rename to ndb/test/src/NdbSchemaOp.cpp index aa2d0be311f..a296094ea9d 100644 --- a/ndb/src/ndbapi/NdbSchemaOp.cpp +++ b/ndb/test/src/NdbSchemaOp.cpp @@ -34,11 +34,11 @@ Adjust: 980125 UABMNST First version. NOTE: This file is only used as a compatibility layer for old test programs, New programs should use NdbDictionary.hpp *****************************************************************************/ -#include -#include "NdbSchemaOp.hpp" -#include "NdbSchemaCon.hpp" -#include "API.hpp" +#include +#include +#include +#include /***************************************************************************** diff --git a/ndb/test/tools/Makefile.am b/ndb/test/tools/Makefile.am index 8489bc85fe9..8d94c21b721 100644 --- a/ndb/test/tools/Makefile.am +++ b/ndb/test/tools/Makefile.am @@ -25,7 +25,7 @@ INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmclient include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_ndbapitest.mk.am -ndb_cpcc_LDADD = $(LDADD) $(top_srcdir)/ndb/src/mgmclient/CpcClient.o +ndb_cpcc_LDADD = $(LDADD) $(top_builddir)/ndb/src/mgmclient/CpcClient.o # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/ndb/tools/Makefile.am b/ndb/tools/Makefile.am index caaf0580650..64625f69ea2 100644 --- a/ndb/tools/Makefile.am +++ b/ndb/tools/Makefile.am @@ -1,17 +1,36 @@ -ndbtools_PROGRAMS = ndb_waiter drop_tab delete_all desc drop_index list_tables select_all select_count +ndbtools_PROGRAMS = \ + ndb_waiter \ + ndb_drop_table \ + ndb_delete_all \ + ndb_desc \ + ndb_drop_index \ + ndb_show_tables \ + ndb_select_all \ + ndb_select_count -ndb_waiter_SOURCES = waiter.cpp -delete_all_SOURCES = delete_all.cpp -desc_SOURCES = desc.cpp -drop_index_SOURCES = drop_index.cpp -drop_tab_SOURCES = drop_tab.cpp -list_tables_SOURCES = listTables.cpp -select_all_SOURCES = select_all.cpp -select_count_SOURCES = select_count.cpp +tools_common_sources = ../test/src/NDBT_ReturnCodes.cpp ../test/src/NDBT_Table.cpp ../test/src/NDBT_Output.cpp + +ndb_waiter_SOURCES = waiter.cpp $(tools_common_sources) +ndb_delete_all_SOURCES = delete_all.cpp $(tools_common_sources) +ndb_desc_SOURCES = desc.cpp $(tools_common_sources) +ndb_drop_index_SOURCES = drop_index.cpp $(tools_common_sources) +ndb_drop_table_SOURCES = drop_tab.cpp $(tools_common_sources) +ndb_show_tables_SOURCES = listTables.cpp $(tools_common_sources) +ndb_select_all_SOURCES = select_all.cpp ../test/src/NDBT_ResultRow.cpp $(tools_common_sources) +ndb_select_count_SOURCES = select_count.cpp $(tools_common_sources) include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_ndbapitools.mk.am +ndb_waiter_LDFLAGS = @ndb_bin_am_ldflags@ +ndb_drop_table_LDFLAGS = @ndb_bin_am_ldflags@ +ndb_delete_all_LDFLAGS = @ndb_bin_am_ldflags@ +ndb_desc_LDFLAGS = @ndb_bin_am_ldflags@ +ndb_drop_index_LDFLAGS = @ndb_bin_am_ldflags@ +ndb_show_tables_LDFLAGS = @ndb_bin_am_ldflags@ +ndb_select_all_LDFLAGS = @ndb_bin_am_ldflags@ +ndb_select_count_LDFLAGS = @ndb_bin_am_ldflags@ + # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/ndb/tools/delete_all.cpp b/ndb/tools/delete_all.cpp index 9cbba503e68..dabd9a0e8fa 100644 --- a/ndb/tools/delete_all.cpp +++ b/ndb/tools/delete_all.cpp @@ -23,19 +23,16 @@ #include -#include +static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism=240); int main(int argc, const char** argv){ const char* _tabname = NULL; const char* _dbname = "TEST_DB"; int _help = 0; - int _ver2 = 1; struct getargs args[] = { { "usage", '?', arg_flag, &_help, "Print help", "" }, - { "ver2", '2', arg_flag, &_ver2, "Use version 2 of clearTable (default)", "" }, - { "ver2", '1', arg_negative_flag, &_ver2, "Use version 1 of clearTable", "" }, { "database", 'd', arg_string, &_dbname, "dbname", "Name of database table is in"} }; @@ -74,20 +71,111 @@ int main(int argc, const char** argv){ } ndbout << "Deleting all from " << argv[i] << "..."; - UtilTransactions utilTrans(*pTab); - int tmp = NDBT_OK; - if (_ver2 == 0){ - if(utilTrans.clearTable(&MyNdb) == NDBT_FAILED) - tmp = NDBT_FAILED; - } else { - if(utilTrans.clearTable3(&MyNdb) == NDBT_FAILED) - tmp = NDBT_FAILED; - } - if(tmp == NDBT_FAILED){ - res = tmp; + if(clear_table(&MyNdb, pTab) == NDBT_FAILED){ + res = NDBT_FAILED; ndbout << "FAILED" << endl; } } return NDBT_ProgramExit(res); } + +int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism) +{ + // Scan all records exclusive and delete + // them one by one + int retryAttempt = 0; + const int retryMax = 10; + int deletedRows = 0; + int check; + NdbConnection *pTrans; + NdbScanOperation *pOp; + NdbError err; + + int par = parallelism; + while (true){ + restart: + if (retryAttempt++ >= retryMax){ + g_info << "ERROR: has retried this operation " << retryAttempt + << " times, failing!" << endl; + return NDBT_FAILED; + } + + pTrans = pNdb->startTransaction(); + if (pTrans == NULL) { + err = pNdb->getNdbError(); + if (err.status == NdbError::TemporaryError){ + ERR(err); + NdbSleep_MilliSleep(50); + continue; + } + goto failed; + } + + pOp = pTrans->getNdbScanOperation(pTab->getName()); + if (pOp == NULL) { + goto failed; + } + + NdbResultSet * rs = pOp->readTuplesExclusive(par); + if( rs == 0 ) { + goto failed; + } + + if(pTrans->execute(NoCommit) != 0){ + err = pTrans->getNdbError(); + if(err.status == NdbError::TemporaryError){ + ERR(err); + pNdb->closeTransaction(pTrans); + NdbSleep_MilliSleep(50); + continue; + } + goto failed; + } + + while((check = rs->nextResult(true)) == 0){ + do { + if (rs->deleteTuple() != 0){ + goto failed; + } + deletedRows++; + } while((check = rs->nextResult(false)) == 0); + + if(check != -1){ + check = pTrans->execute(Commit); + pTrans->releaseCompletedOperations(); + } + + err = pTrans->getNdbError(); + if(check == -1){ + if(err.status == NdbError::TemporaryError){ + ERR(err); + pNdb->closeTransaction(pTrans); + NdbSleep_MilliSleep(50); + par = 1; + goto restart; + } + goto failed; + } + } + if(check == -1){ + err = pTrans->getNdbError(); + if(err.status == NdbError::TemporaryError){ + ERR(err); + pNdb->closeTransaction(pTrans); + NdbSleep_MilliSleep(50); + par = 1; + goto restart; + } + goto failed; + } + pNdb->closeTransaction(pTrans); + return NDBT_OK; + } + return NDBT_FAILED; + + failed: + if(pTrans != 0) pNdb->closeTransaction(pTrans); + ERR(err); + return (err.code != 0 ? err.code : NDBT_FAILED); +} diff --git a/ndb/tools/select_count.cpp b/ndb/tools/select_count.cpp index b1513ad4135..cae91feb378 100644 --- a/ndb/tools/select_count.cpp +++ b/ndb/tools/select_count.cpp @@ -26,6 +26,12 @@ #include #include +static int +select_count(Ndb* pNdb, const NdbDictionary::Table* pTab, + int parallelism, + int* count_rows, + UtilTransactions::ScanLock lock, + NdbConnection* pBuddyTrans=0); int main(int argc, const char** argv){ const char* _dbname = "TEST_DB"; @@ -75,9 +81,8 @@ int main(int argc, const char** argv){ } int rows = 0; - UtilTransactions utilTrans(*pTab); - if (utilTrans.selectCount(&MyNdb, _parallelism, &rows, - (UtilTransactions::ScanLock)_lock) != 0){ + if (select_count(&MyNdb, pTab, _parallelism, &rows, + (UtilTransactions::ScanLock)_lock) != 0){ return NDBT_ProgramExit(NDBT_FAILED); } @@ -86,5 +91,109 @@ int main(int argc, const char** argv){ return NDBT_ProgramExit(NDBT_OK); } +int +select_count(Ndb* pNdb, const NdbDictionary::Table* pTab, + int parallelism, + int* count_rows, + UtilTransactions::ScanLock lock, + NdbConnection* pBuddyTrans){ + + int retryAttempt = 0; + const int retryMax = 100; + int check; + NdbConnection *pTrans; + NdbOperation *pOp; + + while (true){ + + if (retryAttempt >= retryMax){ + g_info << "ERROR: has retried this operation " << retryAttempt + << " times, failing!" << endl; + return NDBT_FAILED; + } + + pTrans = pNdb->hupp(pBuddyTrans); + if (pTrans == NULL) { + const NdbError err = pNdb->getNdbError(); + + if (err.status == NdbError::TemporaryError){ + NdbSleep_MilliSleep(50); + retryAttempt++; + continue; + } + ERR(err); + return NDBT_FAILED; + } + pOp = pTrans->getNdbOperation(pTab->getName()); + if (pOp == NULL) { + ERR(pTrans->getNdbError()); + pNdb->closeTransaction(pTrans); + return NDBT_FAILED; + } + + switch(lock){ + case UtilTransactions::SL_ReadHold: + check = pOp->openScanReadHoldLock(parallelism); + break; + case UtilTransactions::SL_Exclusive: + check = pOp->openScanExclusive(parallelism); + break; + case UtilTransactions::SL_Read: + default: + check = pOp->openScanRead(parallelism); + } + + if( check == -1 ) { + ERR(pTrans->getNdbError()); + pNdb->closeTransaction(pTrans); + return NDBT_FAILED; + } + + check = pOp->interpret_exit_ok(); + if( check == -1 ) { + ERR(pTrans->getNdbError()); + pNdb->closeTransaction(pTrans); + return NDBT_FAILED; + } + + check = pTrans->executeScan(); + if( check == -1 ) { + ERR(pTrans->getNdbError()); + pNdb->closeTransaction(pTrans); + return NDBT_FAILED; + } + + int eof; + int rows = 0; + eof = pTrans->nextScanResult(); + + while(eof == 0){ + rows++; + eof = pTrans->nextScanResult(); + } + if (eof == -1) { + const NdbError err = pTrans->getNdbError(); + + if (err.status == NdbError::TemporaryError){ + pNdb->closeTransaction(pTrans); + NdbSleep_MilliSleep(50); + retryAttempt++; + continue; + } + ERR(err); + pNdb->closeTransaction(pTrans); + return NDBT_FAILED; + } + + pNdb->closeTransaction(pTrans); + + if (count_rows != NULL){ + *count_rows = rows; + } + + return NDBT_OK; + } + return NDBT_FAILED; +} diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp index d57daff3aea..7ce2739a157 100644 --- a/ndb/tools/waiter.cpp +++ b/ndb/tools/waiter.cpp @@ -15,17 +15,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "mgmapi.h" +#include #include #include #include #include #include +#include +#include "../src/common/mgmcommon/LocalConfig.hpp" - -#include #include +int +waitClusterStarted(const char* _addr, unsigned int _timeout= 120); + int main(int argc, const char** argv){ const char* _hostName = NULL; @@ -45,12 +48,252 @@ int main(int argc, const char** argv){ arg_printusage(args, num_args, argv[0], desc); return NDBT_ProgramExit(NDBT_WRONGARGS); } + + char buf[255]; _hostName = argv[optind]; - NdbRestarter restarter(_hostName); + if (_hostName == NULL){ + LocalConfig lcfg; + if(!lcfg.init()) + { + lcfg.printError(); + lcfg.printUsage(); + g_err << "Error parsing local config file" << endl; + return NDBT_ProgramExit(NDBT_FAILED); + } - if (restarter.waitClusterStarted() != 0) + for (int i = 0; itype){ + case MgmId_TCP: + snprintf(buf, 255, "%s:%d", m->data.tcp.remoteHost, m->data.tcp.port); + _hostName = buf; + break; + case MgmId_File: + break; + default: + break; + } + if (_hostName != NULL) + break; + } + if (_hostName == NULL) + { + g_err << "No management servers configured in local config file" << endl; + return NDBT_ProgramExit(NDBT_FAILED); + } + } + + if (waitClusterStarted(_hostName) != 0) return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_OK); } + +#define MGMERR(h) \ + ndbout << "latest_error="< 0 && attempts > _timeout){ + /** + * Timeout has expired waiting for the nodes to enter + * the state we want + */ + bool waitMore = false; + /** + * Make special check if we are waiting for + * cluster to become started + */ + if(_status == NDB_MGM_NODE_STATUS_STARTED){ + waitMore = true; + /** + * First check if any node is not starting + * then it's no idea to wait anymore + */ + for (size_t n = 0; n < ndbNodes.size(); n++){ + if (ndbNodes[n].node_status != NDB_MGM_NODE_STATUS_STARTED && + ndbNodes[n].node_status != NDB_MGM_NODE_STATUS_STARTING) + waitMore = false; + + } + } + + if (!waitMore || resetAttempts > MAX_RESET_ATTEMPTS){ + g_err << "waitNodeState(" + << ndb_mgm_get_node_status_string(_status) + <<", "<<_startphase<<")" + << " timeout after " << attempts <<" attemps" << endl; + return -1; + } + + g_err << "waitNodeState(" + << ndb_mgm_get_node_status_string(_status) + <<", "<<_startphase<<")" + << " resetting number of attempts " + << resetAttempts << endl; + attempts = 0; + resetAttempts++; + + } + + allInState = true; + if (getStatus() != 0){ + g_err << "getStatus != 0" << endl; + return -1; + } + + // ndbout << "waitNodeState; _num_nodes = " << _num_nodes << endl; + // for (int i = 0; i < _num_nodes; i++) + // ndbout << " node["<node_id << " " + << ndb_mgm_get_node_status_string(ndbNode->node_status)<< endl; + + assert(ndbNode != NULL); + + if(_status == NDB_MGM_NODE_STATUS_STARTING && + ((ndbNode->node_status == NDB_MGM_NODE_STATUS_STARTING && + ndbNode->start_phase >= _startphase) || + (ndbNode->node_status == NDB_MGM_NODE_STATUS_STARTED))) + continue; + + if (_status == NDB_MGM_NODE_STATUS_STARTING){ + g_info << "status = " + << ndb_mgm_get_node_status_string(ndbNode->node_status) + <<", start_phase="<start_phase<node_status != _status) { + if (ndbNode->node_status < _status) + allInState = false; + else + g_info << "node_status(" << ndbNode->node_status + <<") != _status("<<_status<<")"<start_phase < _startphase) + allInState = false; + } else { + if (ndbNode->node_status != _status) + allInState = false; + } + } + g_info << "Waiting for cluster enter state" + << ndb_mgm_get_node_status_string(_status)<< endl; + NdbSleep_SecSleep(1); + attempts++; + } + return 0; +} diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index ef1a895e4eb..189796377cc 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -267,14 +267,14 @@ fi # NDB Cluster if [ x$NDBCLUSTER = x1 ]; then - if [ ! -f ndb/BinDist.sh ]; then - echo "Missing ndb/BinDist.sh"; exit 1 - fi - mkdir $BASE/ndb || exit 1 - # assume we have cpio.. - if (cd ndb && sh BinDist.sh | cpio -pdm $BASE/ndb); then :; else - echo "Copy failed - missing files in ndb/BinDist.sh ?"; exit 1 - fi + ( cd ndb ; make DESTDIR=$BASE/ndb-stage install ) + ( cd mysql-test/ndb ; make DESTDIR=$BASE/ndb-stage install ) + $CP $BASE/ndb-stage@bindir@/* $BASE/bin/. + $CP $BASE/ndb-stage@libexecdir@/* $BASE/bin/. + $CP $BASE/ndb-stage@pkglibdir@/* $BASE/lib/. + $CP -r $BASE/ndb-stage@pkgincludedir@/ndb $BASE/lib/. + $CP -r $BASE/ndb-stage@prefix@/mysql-test/ndb $BASE/mysql-test/. || exit 1 + rm -rf $BASE/ndb-stage fi # Change the distribution to a long descriptive name diff --git a/scripts/mysql_find_rows.sh b/scripts/mysql_find_rows.sh index 3d7bad3323e..91ffc326e16 100644 --- a/scripts/mysql_find_rows.sh +++ b/scripts/mysql_find_rows.sh @@ -16,7 +16,7 @@ usage() if ($opt_help || $opt_Information); $query=$search=$database=$set=""; $eoq=0; while (<>) { - next if (length($query) == 0 && /^\#/); # Skipp comments + next if (length($query) == 0 && /^\#/); # Skip comments $query.=search($_); if ($eoq) { diff --git a/sql-common/client.c b/sql-common/client.c index 591a0b9f0cb..962faf5cbe1 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -751,6 +751,58 @@ static my_bool is_NT(void) } #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 */ + + /************************************************************************** Shut down connection **************************************************************************/ @@ -1783,40 +1835,39 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, } /* Set character set */ - if (mysql->options.charset_name) + if (!mysql->options.charset_name && + !(mysql->options.charset_name= + my_strdup(MYSQL_DEFAULT_CHARSET_NAME,MYF(MY_WME)))) + goto error; + { const char *save= charsets_dir; if (mysql->options.charset_dir) charsets_dir=mysql->options.charset_dir; mysql->charset=get_charset_by_csname(mysql->options.charset_name, - MY_CS_PRIMARY, - MYF(MY_WME)); + MY_CS_PRIMARY, MYF(MY_WME)); charsets_dir= save; - - if (!mysql->charset) - { - net->last_errno=CR_CANT_READ_CHARSET; - strmov(net->sqlstate, unknown_sqlstate); - if (mysql->options.charset_dir) - my_snprintf(net->last_error, sizeof(net->last_error)-1, - ER(net->last_errno), - mysql->options.charset_name, - mysql->options.charset_dir); - else - { - char cs_dir_name[FN_REFLEN]; - get_charsets_dir(cs_dir_name); - my_snprintf(net->last_error, sizeof(net->last_error)-1, - ER(net->last_errno), - mysql->options.charset_name, - cs_dir_name); - } - goto error; - } } - else + + if (!mysql->charset) { - mysql->charset= default_charset_info; + net->last_errno=CR_CANT_READ_CHARSET; + strmov(net->sqlstate, unknown_sqlstate); + if (mysql->options.charset_dir) + my_snprintf(net->last_error, sizeof(net->last_error)-1, + ER(net->last_errno), + mysql->options.charset_name, + mysql->options.charset_dir); + else + { + char cs_dir_name[FN_REFLEN]; + get_charsets_dir(cs_dir_name); + my_snprintf(net->last_error, sizeof(net->last_error)-1, + ER(net->last_errno), + mysql->options.charset_name, + cs_dir_name); + } + goto error; } @@ -1996,10 +2047,14 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, goto error; } - if (client_flag & CLIENT_COMPRESS) /* We will use compression */ net->compress=1; +#ifdef CHECK_LICENSE + if (check_license(mysql)) + goto error; +#endif + if (db && mysql_select_db(mysql,db)) goto error; diff --git a/sql/Makefile.am b/sql/Makefile.am index 469b82f95fa..cdbf78bed0e 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -58,7 +58,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ log_event.h sql_repl.h slave.h \ stacktrace.h sql_sort.h sql_cache.h set_var.h \ spatial.h gstream.h client_settings.h \ - examples/ha_example.h + examples/ha_example.h examples/ha_archive.h mysqld_SOURCES = sql_lex.cc sql_handler.cc \ item.cc item_sum.cc item_buff.cc item_func.cc \ item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \ @@ -88,7 +88,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \ client.c sql_client.cc mini_client_errors.c pack.c\ stacktrace.c repl_failsafe.h repl_failsafe.cc \ gstream.cc spatial.cc sql_help.cc protocol_cursor.cc \ - examples/ha_example.cc + examples/ha_example.cc examples/ha_archive.cc gen_lex_hash_SOURCES = gen_lex_hash.cc gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS) diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc new file mode 100644 index 00000000000..001ab735497 --- /dev/null +++ b/sql/examples/ha_archive.cc @@ -0,0 +1,586 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef __GNUC__ +#pragma implementation // gcc: Class implementation +#endif + +#include + +#ifdef HAVE_ARCHIVE_DB +#include "ha_archive.h" + +/* + First, if you want to understand storage engines you should look at + ha_example.cc and ha_example.h. + This example was written as a test case for a customer who needed + a storage engine without indexes that could compress data very well. + So, welcome to a completely compressed storage engine. This storage + engine only does inserts. No replace, deletes, or updates. All reads are + complete table scans. Compression is done through gzip (bzip compresses + better, but only marginally, if someone asks I could add support for + it too, but beaware that it costs a lot more in CPU time then gzip). + + We keep a file pointer open for each instance of ha_archive for each read + but for writes we keep one open file handle just for that. We flush it + only if we have a read occur. gzip handles compressing lots of records + at once much better then doing lots of little records between writes. + It is possible to not lock on writes but this would then mean we couldn't + handle bulk inserts as well (that is if someone was trying to read at + the same time since we would want to flush). + + No attempts at durability are made. You can corrupt your data. + + For performance as far as table scans go it is quite fast. I don't have + good numbers but locally it has out performed both Innodb and MyISAM. For + Innodb the question will be if the table can be fit into the buffer + pool. For MyISAM its a question of how much the file system caches the + MyISAM file. With enough free memory MyISAM is faster. Its only when the OS + doesn't have enough memory to cache entire table that archive turns out + to be any faster. For writes it is always a bit slower then MyISAM. It has no + internal limits though for row length. + + Examples between MyISAM (packed) and Archive. + + Table with 76695844 identical rows: + 29680807 a_archive.ARZ + 920350317 a.MYD + + + Table with 8991478 rows (all of Slashdot's comments): + 1922964506 comment_archive.ARZ + 2944970297 comment_text.MYD + + + TODO: + Add bzip optional support. + Allow users to set compression level. + Add truncate table command. + Implement versioning, should be easy. + Implement optimize so we can fix broken tables. + Allow for errors, find a way to mark bad rows. + See if during an optimize you can make the table smaller. + Talk to the gzip guys, come up with a writable format so that updates are doable + without switching to a block method. + Add optional feature so that rows can be flushed at interval (which will cause less + compression but may speed up ordered searches). + + -Brian +*/ + +/* Variables for archive share methods */ +pthread_mutex_t archive_mutex; +static HASH archive_open_tables; +static int archive_init= 0; + +/* The file extension */ +#define ARZ ".ARZ" + +/* + Used for hash table that tracks open tables. +*/ +static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length, + my_bool not_used __attribute__((unused))) +{ + *length=share->table_name_length; + return (byte*) share->table_name; +} + + +/* + Example of simple lock controls. + See ha_example.cc for a description. +*/ +static ARCHIVE_SHARE *get_share(const char *table_name, TABLE *table) +{ + ARCHIVE_SHARE *share; + uint length; + char *tmp_name; + + if (!archive_init) + { + /* Hijack a mutex for init'ing the storage engine */ + pthread_mutex_lock(&LOCK_mysql_create_db); + if (!archive_init) + { + archive_init++; + VOID(pthread_mutex_init(&archive_mutex,MY_MUTEX_INIT_FAST)); + (void) hash_init(&archive_open_tables,system_charset_info,32,0,0, + (hash_get_key) archive_get_key,0,0); + } + pthread_mutex_unlock(&LOCK_mysql_create_db); + } + pthread_mutex_lock(&archive_mutex); + length=(uint) strlen(table_name); + + if (!(share=(ARCHIVE_SHARE*) hash_search(&archive_open_tables, + (byte*) table_name, + length))) + { + if (!(share=(ARCHIVE_SHARE *) + my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &share, sizeof(*share), + &tmp_name, length+1, + NullS))) + { + pthread_mutex_unlock(&archive_mutex); + return NULL; + } + + share->use_count=0; + share->table_name_length=length; + share->table_name=tmp_name; + fn_format(share->data_file_name,table_name,"",ARZ,MY_REPLACE_EXT|MY_UNPACK_FILENAME); + strmov(share->table_name,table_name); + /* + It is expensive to open and close the data files and since you can't have + a gzip file that can be both read and written we keep a writer open + that is shared amoung all open tables. + */ + if ((share->archive_write= gzopen(share->data_file_name, "ab")) == NULL) + goto error; + if (my_hash_insert(&archive_open_tables, (byte*) share)) + goto error; + thr_lock_init(&share->lock); + if (pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST)) + goto error2; + } + share->use_count++; + pthread_mutex_unlock(&archive_mutex); + + return share; + +error2: + thr_lock_delete(&share->lock); + /* We close, but ignore errors since we already have errors */ + (void)gzclose(share->archive_write); +error: + pthread_mutex_unlock(&archive_mutex); + my_free((gptr) share, MYF(0)); + + return NULL; +} + + +/* + Free lock controls. + See ha_example.cc for a description. +*/ +static int free_share(ARCHIVE_SHARE *share) +{ + int rc= 0; + pthread_mutex_lock(&archive_mutex); + if (!--share->use_count) + { + hash_delete(&archive_open_tables, (byte*) share); + thr_lock_delete(&share->lock); + pthread_mutex_destroy(&share->mutex); + my_free((gptr) share, MYF(0)); + if (gzclose(share->archive_write) == Z_ERRNO) + rc= -1; + } + pthread_mutex_unlock(&archive_mutex); + + return rc; +} + + +/* + We just implement one additional file extension. +*/ +const char **ha_archive::bas_ext() const +{ static const char *ext[]= { ARZ, NullS }; return ext; } + + +/* + When opening a file we: + Create/get our shared structure. + Init out lock. + We open the file we will read from. + Set the size of ref_length. +*/ +int ha_archive::open(const char *name, int mode, uint test_if_locked) +{ + DBUG_ENTER("ha_archive::open"); + + if (!(share= get_share(name, table))) + DBUG_RETURN(1); + thr_lock_data_init(&share->lock,&lock,NULL); + + if ((archive= gzopen(share->data_file_name, "rb")) == NULL) + { + (void)free_share(share); //We void since we already have an error + DBUG_RETURN(-1); + } + + DBUG_RETURN(0); +} + + +/* + Closes the file. We first close this storage engines file handle to the + archive and then remove our reference count to the table (and possibly + free it as well). + */ +int ha_archive::close(void) +{ + DBUG_ENTER("ha_archive::close"); + int rc= 0; + if (gzclose(archive) == Z_ERRNO) + rc =-1; + rc |= free_share(share); + DBUG_RETURN(rc); +} + + +/* + We create our data file here. The format is pretty simple. The first bytes in + any file are the version number. Currently we do nothing with this, but in + the future this gives us the ability to figure out version if we change the + format at all. After the version we starting writing our rows. Unlike other + storage engines we do not "pack" our data. Since we are about to do a general + compression, packing would just be a waste of CPU time. If the table has blobs + they are written after the row in the order of creation. + So to read a row we: + Read the version + Read the record and copy it into buf + Loop through any blobs and read them + */ +int ha_archive::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info) +{ + File create_file; + char name_buff[FN_REFLEN]; + size_t written; + DBUG_ENTER("ha_archive::create"); + + if ((create_file= my_create(fn_format(name_buff,name,"",ARZ,MY_REPLACE_EXT|MY_UNPACK_FILENAME),0, + O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) + DBUG_RETURN(-1); + if ((archive= gzdopen(create_file, "ab")) == NULL) + { + delete_table(name); + DBUG_RETURN(-1); + } + version= ARCHIVE_VERSION; + written= gzwrite(archive, &version, sizeof(version)); + if (written == 0 || written != sizeof(version)) + { + delete_table(name); + DBUG_RETURN(-1); + } + if (gzclose(archive)) + { + delete_table(name); + DBUG_RETURN(-1); + } + + DBUG_RETURN(0); +} + +/* + Look at ha_archive::open() for an explanation of the row format. + Here we just write out the row. +*/ +int ha_archive::write_row(byte * buf) +{ + char *pos; + z_off_t written; + DBUG_ENTER("ha_archive::write_row"); + + statistic_increment(ha_write_count,&LOCK_status); + if (table->timestamp_default_now) + update_timestamp(buf+table->timestamp_default_now-1); + written= gzwrite(share->archive_write, buf, table->reclength); + share->dirty= true; + if (written == 0 || written != table->reclength) + DBUG_RETURN(-1); + + for (Field_blob **field=table->blob_field ; *field ; field++) + { + char *ptr; + uint32 size= (*field)->get_length(); + + (*field)->get_ptr(&ptr); + written= gzwrite(share->archive_write, ptr, (unsigned)size); + if (written == 0 || written != size) + DBUG_RETURN(-1); + } + + DBUG_RETURN(0); +} + + +/* + All calls that need to scan the table start with this method. If we are told + that it is a table scan we rewind the file to the beginning, otherwise + we assume the position will be set. +*/ +int ha_archive::rnd_init(bool scan) +{ + DBUG_ENTER("ha_archive::rnd_init"); + int read; // gzread() returns int, and we use this to check the header + + /* We rewind the file so that we can read from the beginning if scan */ + if(scan) + { + records= 0; + if (gzrewind(archive)) + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + } + + /* + If dirty, we lock, and then reset/flush the data. + I found that just calling gzflush() doesn't always work. + */ + if (share->dirty == true) + { + pthread_mutex_lock(&share->mutex); + if (share->dirty == true) + { +/* I was having problems with OSX, but it worked for 10.3 so I am wrapping this with and ifdef */ +#ifdef BROKEN_GZFLUSH + gzclose(share->archive_write); + if ((share->archive_write= gzopen(share->data_file_name, "ab")) == NULL) + { + pthread_mutex_unlock(&share->mutex); + DBUG_RETURN(-1); + } +#else + gzflush(share->archive_write, Z_SYNC_FLUSH); +#endif + share->dirty= false; + } + pthread_mutex_unlock(&share->mutex); + } + + /* + At the moment we just check the size of version to make sure the header is + intact. + */ + if (scan) + { + read= gzread(archive, &version, sizeof(version)); + if (read == 0 || read != sizeof(version)) + DBUG_RETURN(-1); + } + + DBUG_RETURN(0); +} + + +/* + This is the method that is used to read a row. It assumes that the row is + positioned where you want it. +*/ +int ha_archive::get_row(byte *buf) +{ + int read; // Bytes read, gzread() returns int + char *last; + size_t total_blob_length= 0; + DBUG_ENTER("ha_archive::get_row"); + + read= gzread(archive, buf, table->reclength); + + /* If we read nothing we are at the end of the file */ + if (read == 0) + DBUG_RETURN(HA_ERR_END_OF_FILE); + + /* If the record is the wrong size, the file is probably damaged */ + if (read != table->reclength) + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + + /* Calculate blob length, we use this for our buffer */ + for (Field_blob **field=table->blob_field; *field ; field++) + total_blob_length += (*field)->get_length(); + + /* Adjust our row buffer if we need be */ + buffer.alloc(total_blob_length); + last= (char *)buffer.ptr(); + + /* Loop through our blobs and read them */ + for (Field_blob **field=table->blob_field; *field ; field++) + { + size_t size= (*field)->get_length(); + read= gzread(archive, last, size); + if (read == 0 || read != size) + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + (*field)->set_ptr(size, last); + last += size; + } + DBUG_RETURN(0); +} + +/* + Called during ORDER BY. Its position is either from being called sequentially + or by having had ha_archive::rnd_pos() called before it is called. +*/ +int ha_archive::rnd_next(byte *buf) +{ + DBUG_ENTER("ha_archive::rnd_next"); + int rc; + + statistic_increment(ha_read_rnd_next_count,&LOCK_status); + current_position= gztell(archive); + rc= get_row(buf); + if (!(HA_ERR_END_OF_FILE == rc)) + records++; + + DBUG_RETURN(rc); +} + + +/* + Thanks to the table flag HA_REC_NOT_IN_SEQ this will be called after + each call to ha_archive::rnd_next() if an ordering of the rows is + needed. +*/ +void ha_archive::position(const byte *record) +{ + DBUG_ENTER("ha_archive::position"); + ha_store_ptr(ref, ref_length, current_position); + DBUG_VOID_RETURN; +} + + +/* + This is called after a table scan for each row if the results of the scan need + to be ordered. It will take *pos and use it to move the cursor in the file so + that the next row that is called is the correctly ordered row. +*/ +int ha_archive::rnd_pos(byte * buf, byte *pos) +{ + DBUG_ENTER("ha_archive::rnd_pos"); + statistic_increment(ha_read_rnd_count,&LOCK_status); + current_position= ha_get_ptr(pos, ref_length); + z_off_t seek= gzseek(archive, current_position, SEEK_SET); + + DBUG_RETURN(get_row(buf)); +} + +/****************************************************************************** + + Everything below here is default, please look at ha_example.cc for + descriptions. + + ******************************************************************************/ + +int ha_archive::update_row(const byte * old_data, byte * new_data) +{ + + DBUG_ENTER("ha_archive::update_row"); + DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); +} + +int ha_archive::delete_row(const byte * buf) +{ + DBUG_ENTER("ha_archive::delete_row"); + DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); +} + +int ha_archive::index_read(byte * buf, const byte * key, + uint key_len __attribute__((unused)), + enum ha_rkey_function find_flag + __attribute__((unused))) +{ + DBUG_ENTER("ha_archive::index_read"); + DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); +} + +int ha_archive::index_read_idx(byte * buf, uint index, const byte * key, + uint key_len __attribute__((unused)), + enum ha_rkey_function find_flag + __attribute__((unused))) +{ + DBUG_ENTER("ha_archive::index_read_idx"); + DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); +} + + +int ha_archive::index_next(byte * buf) +{ + DBUG_ENTER("ha_archive::index_next"); + DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); +} + +int ha_archive::index_prev(byte * buf) +{ + DBUG_ENTER("ha_archive::index_prev"); + DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); +} + +int ha_archive::index_first(byte * buf) +{ + DBUG_ENTER("ha_archive::index_first"); + DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); +} + +int ha_archive::index_last(byte * buf) +{ + DBUG_ENTER("ha_archive::index_last"); + DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED); +} + + +void ha_archive::info(uint flag) +{ + DBUG_ENTER("ha_archive::info"); + + /* This is a lie, but you don't want the optimizer to see zero or 1 */ + if (records < 2) + records= 2; + + DBUG_VOID_RETURN; +} + +int ha_archive::extra(enum ha_extra_function operation) +{ + DBUG_ENTER("ha_archive::extra"); + DBUG_RETURN(0); +} + +int ha_archive::reset(void) +{ + DBUG_ENTER("ha_archive::reset"); + DBUG_RETURN(0); +} + + +int ha_archive::external_lock(THD *thd, int lock_type) +{ + DBUG_ENTER("ha_archive::external_lock"); + DBUG_RETURN(0); +} + +THR_LOCK_DATA **ha_archive::store_lock(THD *thd, + THR_LOCK_DATA **to, + enum thr_lock_type lock_type) +{ + if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) + lock.type=lock_type; + *to++= &lock; + return to; +} + +ha_rows ha_archive::records_in_range(int inx, + const byte *start_key,uint start_key_len, + enum ha_rkey_function start_search_flag, + const byte *end_key,uint end_key_len, + enum ha_rkey_function end_search_flag) +{ + DBUG_ENTER("ha_archive::records_in_range "); + DBUG_RETURN(records); // HA_ERR_NOT_IMPLEMENTED +} +#endif /* HAVE_ARCHIVE_DB */ diff --git a/sql/examples/ha_archive.h b/sql/examples/ha_archive.h new file mode 100644 index 00000000000..90f64b4c01c --- /dev/null +++ b/sql/examples/ha_archive.h @@ -0,0 +1,123 @@ +/* Copyright (C) 2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef __GNUC__ +#pragma interface /* gcc class implementation */ +#endif + +#include + +/* + Please read ha_archive.cc first. If you are looking for more general + answers on how storage engines work, look at ha_example.cc and + ha_example.h. +*/ + +typedef struct st_archive_share { + char *table_name; + char data_file_name[FN_REFLEN]; + uint table_name_length,use_count; + pthread_mutex_t mutex; + THR_LOCK lock; + gzFile archive_write; /* Archive file we are working with */ + bool dirty; /* Flag for if a flush should occur */ +} ARCHIVE_SHARE; + +/* + Version for file format. + 1 - Initial Version +*/ +#define ARCHIVE_VERSION 1 + +class ha_archive: public handler +{ + THR_LOCK_DATA lock; /* MySQL lock */ + ARCHIVE_SHARE *share; /* Shared lock info */ + gzFile archive; /* Archive file we are working with */ + z_off_t current_position; /* The position of the row we just read */ + byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */ + String buffer; /* Buffer used for blob storage */ + unsigned int version; /* Used for recording version */ + +public: + ha_archive(TABLE *table): handler(table) + { + /* Set our original buffer from pre-allocated memory */ + buffer.set(byte_buffer, IO_SIZE, system_charset_info); + + /* The size of the offset value we will use for position() */ + ref_length = sizeof(z_off_t); + } + ~ha_archive() + { + } + const char *table_type() const { return "ARCHIVE"; } + const char *index_type(uint inx) { return "NONE"; } + const char **bas_ext() const; + ulong table_flags() const + { + return (HA_REC_NOT_IN_SEQ | HA_NOT_EXACT_COUNT | HA_NO_WRITE_DELAYED | + HA_NO_AUTO_INCREMENT); + } + ulong index_flags(uint inx) const + { + return 0; + } + /* + This is just a default, there is no real limit as far as + archive is concerned. + */ + uint max_record_length() const { return HA_MAX_REC_LENGTH; } + uint max_keys() const { return 0; } + uint max_key_parts() const { return 0; } + uint max_key_length() const { return 0; } + /* + Called in test_quick_select to determine if indexes should be used. + */ + virtual double scan_time() { return (double) (records) / 20.0+10; } + /* The next method will never be called */ + virtual double read_time(ha_rows rows) { return (double) rows / 20.0+1; } + int open(const char *name, int mode, uint test_if_locked); + int close(void); + int write_row(byte * buf); + int update_row(const byte * old_data, byte * new_data); + int delete_row(const byte * buf); + int index_read(byte * buf, const byte * key, + uint key_len, enum ha_rkey_function find_flag); + int index_read_idx(byte * buf, uint idx, const byte * key, + uint key_len, enum ha_rkey_function find_flag); + int index_next(byte * buf); + int index_prev(byte * buf); + int index_first(byte * buf); + int index_last(byte * buf); + int rnd_init(bool scan=1); + int rnd_next(byte *buf); + int rnd_pos(byte * buf, byte *pos); + int get_row(byte *buf); + void position(const byte *record); + void info(uint); + int extra(enum ha_extra_function operation); + int reset(void); + int external_lock(THD *thd, int lock_type); + ha_rows records_in_range(int inx, const byte *start_key,uint start_key_len, + enum ha_rkey_function start_search_flag, + const byte *end_key,uint end_key_len, + enum ha_rkey_function end_search_flag); + int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); + + THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type); +}; diff --git a/sql/examples/ha_example.cc b/sql/examples/ha_example.cc index 2d17caf1a83..4c192a94b4b 100644 --- a/sql/examples/ha_example.cc +++ b/sql/examples/ha_example.cc @@ -596,6 +596,10 @@ THR_LOCK_DATA **ha_example::store_lock(THD *thd, shared references released. The variable name will just be the name of the table. You will need to remove any files you have created at this point. + If you do not implement this, the default delete_table() is called from + handler.cc and it will delete all files with the file extentions returned + by bas_ext(). + Called from handler.cc by delete_table and ha_create_table(). Only used during create if the table_flag HA_DROP_BEFORE_CREATE was specified for the storage engine. @@ -610,6 +614,10 @@ int ha_example::delete_table(const char *name) /* Renames a table from one name to another from alter table call. + If you do not implement this, the default rename_table() is called from + handler.cc and it will delete all files with the file extentions returned + by bas_ext(). + Called from sql_table.cc by mysql_rename_table(). */ int ha_example::rename_table(const char * from, const char * to) diff --git a/sql/examples/ha_example.h b/sql/examples/ha_example.h index 2228f04284a..cd8baac2017 100644 --- a/sql/examples/ha_example.h +++ b/sql/examples/ha_example.h @@ -21,6 +21,10 @@ that you can implement. */ +#ifdef __GNUC__ +#pragma interface /* gcc class implementation */ +#endif + /* EXAMPLE_SHARE is a structure that will be shared amoung all open handlers The example implements the minimum of what you will probably need. @@ -87,7 +91,6 @@ public: The next method will never be called if you do not implement indexes. */ virtual double read_time(ha_rows rows) { return (double) rows / 20.0+1; } - virtual bool fast_key_read() { return 1;} /* Everything below are methods that we implment in ha_example.cc. diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 71c9a5c3b18..619c05711c4 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -66,6 +66,7 @@ extern "C" { #include "../innobase/include/trx0roll.h" #include "../innobase/include/trx0trx.h" #include "../innobase/include/trx0sys.h" +#include "../innobase/include/mtr0mtr.h" #include "../innobase/include/row0ins.h" #include "../innobase/include/row0mysql.h" #include "../innobase/include/row0sel.h" @@ -1747,9 +1748,14 @@ innobase_mysql_cmp( } } - ret = my_strnncoll(charset, - a, a_length, - b, b_length); + /* Starting from 4.1.3 we use strnncollsp() in comparisons of + non-latin1_swedish_ci strings. NOTE that the collation order + changes then: 'b\0\0...' is ordered BEFORE 'b ...'. Users + having indexes on such data need to rebuild their tables! */ + + ret = charset->coll->strnncollsp(charset, + a, a_length, + b, b_length); if (ret < 0) { return(-1); } else if (ret > 0) { @@ -4657,6 +4663,21 @@ ha_innobase::start_stmt( prepared for an update of a row */ prebuilt->select_lock_type = LOCK_X; + } else { + if (thd->lex->sql_command == SQLCOM_SELECT + && thd->lex->lock_option == TL_READ) { + + /* For other than temporary tables, we obtain + no lock for consistent read (plain SELECT) */ + + prebuilt->select_lock_type = LOCK_NONE; + } else { + /* Not a consistent read: use LOCK_X as the + select_lock_type value (TODO: how could we know + whether it should be LOCK_S, LOCK_X, or LOCK_NONE?) */ + + prebuilt->select_lock_type = LOCK_X; + } } /* Set the MySQL flag to mark that there is an active transaction */ @@ -5162,4 +5183,36 @@ ha_innobase::get_auto_increment() return(nr); } +/*********************************************************************** +This function stores binlog offset and flushes logs */ + +void +innobase_store_binlog_offset_and_flush_log( +/*=============================*/ + char *binlog_name, /* in: binlog name */ + longlong offset /* in: binlog offset */ +) +{ + mtr_t mtr; + + assert(binlog_name != NULL); + + /* Start a mini-transaction */ + mtr_start_noninline(&mtr); + + /* Update the latest MySQL binlog name and offset info + in trx sys header */ + + trx_sys_update_mysql_binlog_offset( + binlog_name, + offset, + TRX_SYS_MYSQL_LOG_INFO, &mtr); + + /* Commits the mini-transaction */ + mtr_commit(&mtr); + + /* Syncronous flush of the log buffer to disk */ + log_buffer_flush_to_disk(); +} + #endif /* HAVE_INNOBASE_DB */ diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 3c7852c703a..318e0fbb507 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -60,13 +60,11 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, DBUG_PRINT(msg_type,("message: %s",msgbuf)); -#ifndef EMBEDDED_LIBRARY - if (thd->net.vio == 0) + if (!thd->vio_ok()) { sql_print_error(msgbuf); return; } -#endif if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR | T_AUTO_REPAIR)) diff --git a/sql/handler.cc b/sql/handler.cc index 4a2948e63f8..717b2ee0ce8 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -35,6 +35,9 @@ #ifdef HAVE_EXAMPLE_DB #include "examples/ha_example.h" #endif +#ifdef HAVE_ARCHIVE_DB +#include "examples/ha_archive.h" +#endif #ifdef HAVE_INNOBASE_DB #include "ha_innodb.h" #else @@ -88,6 +91,8 @@ struct show_table_type_st sys_table_types[]= "Alias for NDBCLUSTER", DB_TYPE_NDBCLUSTER}, {"EXAMPLE",&have_example_db, "Example storage engine", DB_TYPE_EXAMPLE_DB}, + {"ARCHIVE",&have_archive_db, + "Archive storage engine", DB_TYPE_ARCHIVE_DB}, {NullS, NULL, NullS, DB_TYPE_UNKNOWN} }; @@ -189,6 +194,10 @@ handler *get_new_handler(TABLE *table, enum db_type db_type) case DB_TYPE_EXAMPLE_DB: return new ha_example(table); #endif +#ifdef HAVE_ARCHIVE_DB + case DB_TYPE_ARCHIVE_DB: + return new ha_archive(table); +#endif #ifdef HAVE_NDBCLUSTER_DB case DB_TYPE_NDBCLUSTER: return new ha_ndbcluster(table); diff --git a/sql/handler.h b/sql/handler.h index 04a437725ab..e7dcb97f0e8 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -158,7 +158,7 @@ enum db_type DB_TYPE_MRG_ISAM, DB_TYPE_MYISAM, DB_TYPE_MRG_MYISAM, DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB, DB_TYPE_GEMINI, DB_TYPE_NDBCLUSTER, - DB_TYPE_EXAMPLE_DB, + DB_TYPE_EXAMPLE_DB, DB_TYPE_ARCHIVE_DB, DB_TYPE_DEFAULT // Must be last }; diff --git a/sql/item.cc b/sql/item.cc index 7db1a448e55..8f5cd3df3fd 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -255,7 +255,7 @@ bool Item::get_time(TIME *ltime) return 0; } -CHARSET_INFO * Item::default_charset() const +CHARSET_INFO *Item::default_charset() { return current_thd->variables.collation_connection; } @@ -629,6 +629,7 @@ Item_param::Item_param(unsigned pos_in_query_arg) : state(NO_VALUE), item_result_type(STRING_RESULT), item_type(STRING_ITEM), + param_type(MYSQL_TYPE_STRING), pos_in_query(pos_in_query_arg), set_param_func(default_set_param_func) { @@ -735,6 +736,70 @@ bool Item_param::set_longdata(const char *str, ulong length) } +/* + Set parameter value from user variable value. + + SYNOPSIS + set_from_user_var + thd Current thread + entry User variable structure (NULL means use NULL value) + + RETURN + 0 OK + 1 Out of memort +*/ + +bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry) +{ + DBUG_ENTER("Item_param::set_from_user_var"); + if (entry && entry->value) + { + item_result_type= entry->type; + switch (entry->type) + { + case REAL_RESULT: + set_double(*(double*)entry->value); + break; + case INT_RESULT: + set_int(*(longlong*)entry->value, 21); + break; + case STRING_RESULT: + { + CHARSET_INFO *fromcs= entry->collation.collation; + CHARSET_INFO *tocs= thd->variables.collation_connection; + uint32 dummy_offset; + + value.cs_info.character_set_client= fromcs; + /* + Setup source and destination character sets so that they + are different only if conversion is necessary: this will + make later checks easier. + */ + value.cs_info.final_character_set_of_str_value= + String::needs_conversion(0, fromcs, tocs, &dummy_offset) ? + tocs : fromcs; + /* + Exact value of max_length is not known unless data is converted to + charset of connection, so we have to set it later. + */ + item_type= Item::STRING_ITEM; + item_result_type= STRING_RESULT; + + if (set_str((const char *)entry->value, entry->length)) + DBUG_RETURN(1); + } + break; + default: + DBUG_ASSERT(0); + set_null(); + } + } + else + set_null(); + + DBUG_RETURN(0); +} + /* Resets parameter after execution. @@ -767,8 +832,6 @@ void Item_param::reset() int Item_param::save_in_field(Field *field, bool no_conversions) { - DBUG_ASSERT(current_thd->command == COM_EXECUTE); - field->set_notnull(); switch (state) { @@ -808,6 +871,17 @@ bool Item_param::get_time(TIME *res) } +bool Item_param::get_date(TIME *res, uint fuzzydate) +{ + if (state == TIME_VALUE) + { + *res= value.time; + return 0; + } + return Item::get_date(res, fuzzydate); +} + + double Item_param::val() { switch (state) { diff --git a/sql/item.h b/sql/item.h index 885a34dce81..e373eb112c0 100644 --- a/sql/item.h +++ b/sql/item.h @@ -245,7 +245,7 @@ public: virtual Item *real_item() { return this; } virtual Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); } - CHARSET_INFO *default_charset() const; + static CHARSET_INFO *default_charset(); virtual CHARSET_INFO *compare_collation() { return NULL; } virtual bool walk(Item_processor processor, byte *arg) @@ -465,6 +465,16 @@ public: /* Cached values for virtual methods to save us one switch. */ enum Item_result item_result_type; enum Type item_type; + + /* + Used when this item is used in a temporary table. + This is NOT placeholder metadata sent to client, as this value + is assigned after sending metadata (in setup_one_conversion_function). + For example in case of 'SELECT ?' you'll get MYSQL_TYPE_STRING both + in result set and placeholders metadata, no matter what type you will + supply for this placeholder in mysql_stmt_execute. + */ + enum enum_field_types param_type; /* Offset of placeholder inside statement text. Used to create no-placeholders version of this statement for the binary log. @@ -475,12 +485,13 @@ public: enum Item_result result_type () const { return item_result_type; } enum Type type() const { return item_type; } - enum_field_types field_type() const { return MYSQL_TYPE_STRING; } + enum_field_types field_type() const { return param_type; } double val(); longlong val_int(); String *val_str(String*); bool get_time(TIME *tm); + bool get_date(TIME *tm, uint fuzzydate); int save_in_field(Field *field, bool no_conversions); void set_null(); @@ -489,6 +500,7 @@ public: bool set_str(const char *str, ulong length); bool set_longdata(const char *str, ulong length); void set_time(TIME *tm, timestamp_type type, uint32 max_length_arg); + bool set_from_user_var(THD *thd, const user_var_entry *entry); void reset(); /* Assign placeholder value from bind data. diff --git a/sql/item_func.cc b/sql/item_func.cc index f221e0dcc5c..53c6884c5de 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2583,27 +2583,39 @@ longlong Item_func_get_user_var::val_int() /* + Get variable by name and, if necessary, put the record of variable + use into the binary log. + + SYNOPSIS + get_var_with_binlog() + thd Current thread + name Variable name + out_entry [out] variable structure or NULL. The pointer is set + regardless of whether function succeeded or not. + When a user variable is invoked from an update query (INSERT, UPDATE etc), stores this variable and its value in thd->user_var_events, so that it can be written to the binlog (will be written just before the query is written, see log.cc). + + RETURN + 0 OK + 1 Failed to put appropiate record into binary log + */ -void Item_func_get_user_var::fix_length_and_dec() +int get_var_with_binlog(THD *thd, LEX_STRING &name, + user_var_entry **out_entry) { - THD *thd=current_thd; BINLOG_USER_VAR_EVENT *user_var_event; - maybe_null=1; - decimals=NOT_FIXED_DEC; - max_length=MAX_BLOB_WIDTH; - - if (!(var_entry= get_variable(&thd->user_vars, name, 0))) - null_value= 1; - else - collation.set(var_entry->collation); + user_var_entry *var_entry; + var_entry= get_variable(&thd->user_vars, name, 0); if (!(opt_bin_log && is_update_query(thd->lex->sql_command))) - return; + { + *out_entry= var_entry; + return 0; + } if (!var_entry) { @@ -2630,13 +2642,16 @@ void Item_func_get_user_var::fix_length_and_dec() if (!(var_entry= get_variable(&thd->user_vars, name, 0))) goto err; } - /* - If this variable was already stored in user_var_events by this query - (because it's used in more than one place in the query), don't store - it. - */ else if (var_entry->used_query_id == thd->query_id) - return; + { + /* + If this variable was already stored in user_var_events by this query + (because it's used in more than one place in the query), don't store + it. + */ + *out_entry= var_entry; + return 0; + } uint size; /* @@ -2671,11 +2686,34 @@ void Item_func_get_user_var::fix_length_and_dec() var_entry->used_query_id= thd->query_id; if (insert_dynamic(&thd->user_var_events, (gptr) &user_var_event)) goto err; - - return; + + *out_entry= var_entry; + return 0; err: - thd->fatal_error(); + *out_entry= var_entry; + return 1; +} + + +void Item_func_get_user_var::fix_length_and_dec() +{ + THD *thd=current_thd; + int error; + maybe_null=1; + decimals=NOT_FIXED_DEC; + max_length=MAX_BLOB_WIDTH; + + error= get_var_with_binlog(thd, name, &var_entry); + + if (var_entry) + collation.set(var_entry->collation); + else + null_value= 1; + + if (error) + thd->fatal_error(); + return; } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index c6401218fe2..5d8fe8c4aef 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1461,6 +1461,7 @@ void Item_func_encode::fix_length_and_dec() { max_length=args[0]->max_length; maybe_null=args[0]->maybe_null; + collation.set(&my_charset_bin); } String *Item_func_encode::val_str(String *str) @@ -1476,6 +1477,7 @@ String *Item_func_encode::val_str(String *str) res=copy_if_not_alloced(str,res,res->length()); sql_crypt.init(); sql_crypt.encode((char*) res->ptr(),res->length()); + res->set_charset(&my_charset_bin); return res; } @@ -2097,10 +2099,8 @@ String *Item_func_lpad::val_str(String *str) count-= pad_char_length; } if (count > 0) - { - pad->length(pad->charpos(count)); - str->append(*pad); - } + str->append(pad->ptr(), pad->charpos(count), collation.collation); + str->append(*res); null_value= 0; return str; diff --git a/sql/lex.h b/sql/lex.h index e5bc537c213..fde5076a25e 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -133,6 +133,7 @@ static SYMBOL symbols[] = { { "DAY_MICROSECOND", SYM(DAY_MICROSECOND_SYM)}, { "DAY_MINUTE", SYM(DAY_MINUTE_SYM)}, { "DAY_SECOND", SYM(DAY_SECOND_SYM)}, + { "DEALLOCATE", SYM(DEALLOCATE_SYM)}, { "DEC", SYM(DECIMAL_SYM)}, { "DECIMAL", SYM(DECIMAL_SYM)}, { "DEFAULT", SYM(DEFAULT)}, @@ -310,6 +311,7 @@ static SYMBOL symbols[] = { { "OFFSET", SYM(OFFSET_SYM)}, { "OLD_PASSWORD", SYM(OLD_PASSWORD)}, { "ON", SYM(ON)}, + { "ONE_SHOT", SYM(ONE_SHOT_SYM)}, { "OPEN", SYM(OPEN_SYM)}, { "OPTIMIZE", SYM(OPTIMIZE)}, { "OPTION", SYM(OPTION)}, @@ -324,6 +326,7 @@ static SYMBOL symbols[] = { { "POINT", SYM(POINT_SYM)}, { "POLYGON", SYM(POLYGON)}, { "PRECISION", SYM(PRECISION)}, + { "PREPARE", SYM(PREPARE_SYM)}, { "PREV", SYM(PREV_SYM)}, { "PRIMARY", SYM(PRIMARY_SYM)}, { "PRIVILEGES", SYM(PRIVILEGES)}, diff --git a/sql/log.cc b/sql/log.cc index 8df5ea5096b..e7a142230b1 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1231,6 +1231,40 @@ bool MYSQL_LOG::write(Log_event* event_info) if (thd) { +#if MYSQL_VERSION_ID < 50000 + /* + To make replication of charsets working in 4.1 we are writing values + of charset related variables before every statement in the binlog, + if values of those variables differ from global server-wide defaults. + We are using SET ONE_SHOT command so that the charset vars get reset + to default after the first non-SET statement. + In the next 5.0 this won't be needed as we will use the new binlog + format to store charset info. + */ + if ((thd->variables.character_set_client->number != + global_system_variables.collation_server->number) || + (thd->variables.character_set_client->number != + thd->variables.collation_connection->number) || + (thd->variables.collation_server->number != + thd->variables.collation_connection->number)) + { + char buf[200]; + int written= my_snprintf(buf, sizeof(buf)-1, + "SET ONE_SHOT CHARACTER_SET_CLIENT=%lu,\ +COLLATION_CONNECTION=%lu,COLLATION_DATABASE=%lu,COLLATION_SERVER=%lu", + thd->variables.character_set_client->number, + thd->variables.collation_connection->number, + thd->variables.collation_database->number, + thd->variables.collation_server->number); + Query_log_event e(thd, buf, written, 0); + e.set_log_pos(this); + if (e.write(file)) + goto err; + } +#endif + + /* Add logging of timezones here */ + if (thd->last_insert_id_used) { Intvar_log_event e(thd,(uchar) LAST_INSERT_ID_EVENT, diff --git a/sql/log_event.cc b/sql/log_event.cc index fd65ec64a76..315b0f670dd 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -202,6 +202,29 @@ static inline int read_str(char * &buf, char *buf_end, char * &str, return 0; } +/* + Transforms a string into "" or its expression in 0x... form. +*/ +static char *str_to_hex(char *to, char *from, uint len) +{ + char *p= to; + if (len) + { + p= strmov(p, "0x"); + for (uint i= 0; i < len; i++, p+= 2) + { + /* val[i] is char. Casting to uchar helps greatly if val[i] < 0 */ + uint tmp= (uint) (uchar) from[i]; + p[0]= _dig_vec_upper[tmp >> 4]; + p[1]= _dig_vec_upper[tmp & 15]; + } + *p= 0; + } + else + p= strmov(p, "\"\""); + return p; // pointer to end 0 of 'to' +} + /************************************************************************** Log_event methods @@ -2176,7 +2199,7 @@ int Rand_log_event::exec_event(struct st_relay_log_info* rli) void User_var_log_event::pack_info(Protocol* protocol) { char *buf= 0; - uint val_offset= 2 + name_len; + uint val_offset= 4 + name_len; uint event_len= val_offset; if (is_null) @@ -2200,16 +2223,21 @@ void User_var_log_event::pack_info(Protocol* protocol) event_len= longlong10_to_str(uint8korr(val), buf + val_offset,-10)-buf; break; case STRING_RESULT: - /* - This is correct as pack_info is used for SHOW BINLOG command - only. But be carefull this is may be incorrect in other cases as - string may contain \ and '. - */ - event_len= val_offset + 2 + val_len; - buf= my_malloc(event_len, MYF(MY_WME)); - buf[val_offset]= '\''; - memcpy(buf + val_offset + 1, val, val_len); - buf[val_offset + val_len + 1]= '\''; + /* 15 is for 'COLLATE' and other chars */ + buf= my_malloc(event_len+val_len*2+1+2*MY_CS_NAME_SIZE+15, MYF(MY_WME)); + CHARSET_INFO *cs; + if (!(cs= get_charset(charset_number, MYF(0)))) + { + strmov(buf+val_offset, "???"); + event_len+= 3; + } + else + { + char *p= strxmov(buf + val_offset, "_", cs->csname, " ", NullS); + p= str_to_hex(p, val, val_len); + p= strxmov(p, " COLLATE ", cs->name, NullS); + event_len= p-buf; + } break; case ROW_RESULT: default: @@ -2218,8 +2246,10 @@ void User_var_log_event::pack_info(Protocol* protocol) } } buf[0]= '@'; - buf[1+name_len]= '='; - memcpy(buf+1, name, name_len); + buf[1]= '`'; + buf[2+name_len]= '`'; + buf[3+name_len]= '='; + memcpy(buf+2, name, name_len); protocol->store(buf, event_len, &my_charset_bin); my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); } @@ -2311,8 +2341,9 @@ void User_var_log_event::print(FILE* file, bool short_form, char* last_db) fprintf(file, "\tUser_var\n"); } - fprintf(file, "SET @"); + fprintf(file, "SET @`"); my_fwrite(file, (byte*) name, (uint) (name_len), MYF(MY_NABP | MY_WME)); + fprintf(file, "`"); if (is_null) { @@ -2332,7 +2363,42 @@ void User_var_log_event::print(FILE* file, bool short_form, char* last_db) fprintf(file, ":=%s;\n", int_buf); break; case STRING_RESULT: - fprintf(file, ":='%s';\n", val); + { + /* + Let's express the string in hex. That's the most robust way. If we + print it in character form instead, we need to escape it with + character_set_client which we don't know (we will know it in 5.0, but + in 4.1 we don't know it easily when we are printing + User_var_log_event). Explanation why we would need to bother with + character_set_client (quoting Bar): + > Note, the parser doesn't switch to another unescaping mode after + > it has met a character set introducer. + > For example, if an SJIS client says something like: + > SET @a= _ucs2 \0a\0b' + > the string constant is still unescaped according to SJIS, not + > according to UCS2. + */ + char *p, *q; + if (!(p= (char *)my_alloca(2*val_len+1+2))) // 2 hex digits per byte + break; // no error, as we are 'void' + str_to_hex(p, val, val_len); + /* + For proper behaviour when mysqlbinlog|mysql, we need to explicitely + specify the variable's collation. It will however cause problems when + people want to mysqlbinlog|mysql into another server not supporting the + character set. But there's not much to do about this and it's unlikely. + */ + CHARSET_INFO *cs; + if (!(cs= get_charset(charset_number, MYF(0)))) + /* + Generate an unusable command (=> syntax error) is probably the best + thing we can do here. + */ + fprintf(file, ":=???;\n"); + else + fprintf(file, ":=_%s %s COLLATE %s;\n", cs->csname, p, cs->name); + my_afree(p); + } break; case ROW_RESULT: default: @@ -2353,7 +2419,9 @@ void User_var_log_event::print(FILE* file, bool short_form, char* last_db) int User_var_log_event::exec_event(struct st_relay_log_info* rli) { Item *it= 0; - CHARSET_INFO *charset= get_charset(charset_number, MYF(0)); + CHARSET_INFO *charset; + if (!(charset= get_charset(charset_number, MYF(MY_WME)))) + return 1; LEX_STRING user_var_name; user_var_name.str= name; user_var_name.length= name_len; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index fb9ff5be771..f9dd4ded94a 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -348,6 +348,7 @@ inline THD *_current_thd(void) #include "field.h" /* Field definitions */ #include "protocol.h" #include "sql_udf.h" +class user_var_entry; #include "item.h" typedef Comp_creator* (*chooser_compare_func_creator)(bool invert); /* sql_parse.cc */ @@ -639,8 +640,10 @@ int mysqld_show_column_types(THD *thd); int mysqld_help (THD *thd, const char *text); /* sql_prepare.cc */ -void mysql_stmt_prepare(THD *thd, char *packet, uint packet_length); +int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length, + LEX_STRING *name=NULL); void mysql_stmt_execute(THD *thd, char *packet, uint packet_length); +void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name); void mysql_stmt_free(THD *thd, char *packet); void mysql_stmt_reset(THD *thd, char *packet); void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length); @@ -915,9 +918,11 @@ extern struct my_option my_long_options[]; /* optional things, have_* variables */ -extern SHOW_COMP_OPTION have_isam, have_innodb, have_berkeley_db, have_example_db; +extern SHOW_COMP_OPTION have_isam, have_innodb, have_berkeley_db; +extern SHOW_COMP_OPTION have_example_db, have_archive_db; extern SHOW_COMP_OPTION have_raid, have_openssl, have_symlink; extern SHOW_COMP_OPTION have_query_cache, have_berkeley_db, have_innodb; +extern SHOW_COMP_OPTION have_geometry, have_rtree_keys; extern SHOW_COMP_OPTION have_crypt; extern SHOW_COMP_OPTION have_compress; @@ -1067,6 +1072,9 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name, LEX_STRING component); Item *get_system_var(THD *thd, enum_var_type var_type, const char *var_name, uint length, const char *item_name); +/* item_func.cc */ +int get_var_with_binlog(THD *thd, LEX_STRING &name, + user_var_entry **out_entry); /* log.cc */ bool flush_error_log(void); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index fbe70705be3..7f91466bb3d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -375,9 +375,10 @@ KEY_CACHE *sql_key_cache; CHARSET_INFO *system_charset_info, *files_charset_info ; CHARSET_INFO *national_charset_info, *table_alias_charset; -SHOW_COMP_OPTION have_berkeley_db, have_innodb, have_isam, - have_ndbcluster, have_example_db; +SHOW_COMP_OPTION have_berkeley_db, have_innodb, have_isam, have_ndbcluster, + have_example_db, have_archive_db; SHOW_COMP_OPTION have_raid, have_openssl, have_symlink, have_query_cache; +SHOW_COMP_OPTION have_geometry, have_rtree_keys; SHOW_COMP_OPTION have_crypt, have_compress; /* Thread specific variables */ @@ -661,7 +662,7 @@ static void close_connections(void) break; } #ifndef __bsdi__ // Bug in BSDI kernel - if (tmp->net.vio) + if (tmp->vio_ok()) { sql_print_error(ER(ER_FORCING_CLOSE),my_progname, tmp->thread_id,tmp->user ? tmp->user : ""); @@ -3958,6 +3959,12 @@ Disable with --skip-bdb (will save memory).", REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"character_set_server", 'C', "Set the default character set.", + (gptr*) &default_character_set_name, (gptr*) &default_character_set_name, + 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, + {"collation_server", OPT_DEFAULT_COLLATION, "Set the default collation.", + (gptr*) &default_collation_name, (gptr*) &default_collation_name, + 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, {"console", OPT_CONSOLE, "Write error output on screen; Don't remove the console window on windows.", (gptr*) &opt_console, (gptr*) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -3991,10 +3998,10 @@ Disable with --skip-bdb (will save memory).", (gptr*) &des_key_file, (gptr*) &des_key_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_OPENSSL */ - {"default-character-set", 'C', "Set the default character set.", + {"default-character-set", 'C', "Set the default character set (Deprecated option, use character_set_server instead).", (gptr*) &default_character_set_name, (gptr*) &default_character_set_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation.", + {"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation (Deprecated option, use character_set_server instead).", (gptr*) &default_collation_name, (gptr*) &default_collation_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, {"default-storage-engine", OPT_STORAGE_ENGINE, @@ -4448,11 +4455,11 @@ replicating a LOAD DATA INFILE command.", NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-warnings", 'W', "Log some not critical warnings to the log file.", (gptr*) &global_system_variables.log_warnings, - (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 1, 0, 0, + (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"warnings", 'W', "Deprecated ; Use --log-warnings instead.", (gptr*) &global_system_variables.log_warnings, - (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 1, 0, 0, + (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0, 0, 0, 0}, { "back_log", OPT_BACK_LOG, "The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.", @@ -5016,6 +5023,12 @@ struct show_var_st status_vars[]= { {"Com_unlock_tables", (char*) (com_stat+(uint) SQLCOM_UNLOCK_TABLES),SHOW_LONG}, {"Com_update", (char*) (com_stat+(uint) SQLCOM_UPDATE),SHOW_LONG}, {"Com_update_multi", (char*) (com_stat+(uint) SQLCOM_UPDATE_MULTI),SHOW_LONG}, + {"Com_prepare_sql", (char*) (com_stat+(uint) SQLCOM_PREPARE), + SHOW_LONG}, + {"Com_execute_sql", (char*) (com_stat+(uint) SQLCOM_EXECUTE), + SHOW_LONG}, + {"Com_dealloc_sql", (char*) (com_stat+(uint) + SQLCOM_DEALLOCATE_PREPARE), SHOW_LONG}, {"Connections", (char*) &thread_id, SHOW_LONG_CONST}, {"Created_tmp_disk_tables", (char*) &created_tmp_disk_tables,SHOW_LONG}, {"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG}, @@ -5337,6 +5350,11 @@ static void mysql_init_variables(void) #else have_example_db= SHOW_OPTION_NO; #endif +#ifdef HAVE_ARCHIVE_DB + have_archive_db= SHOW_OPTION_YES; +#else + have_archive_db= SHOW_OPTION_NO; +#endif #ifdef HAVE_NDBCLUSTER_DB have_ndbcluster=SHOW_OPTION_DISABLED; #else @@ -5362,6 +5380,16 @@ static void mysql_init_variables(void) #else have_query_cache=SHOW_OPTION_NO; #endif +#ifdef HAVE_SPATIAL + have_geometry=SHOW_OPTION_YES; +#else + have_geometry=SHOW_OPTION_NO; +#endif +#ifdef HAVE_RTREE_KEYS + have_rtree_keys=SHOW_OPTION_YES; +#else + have_rtree_keys=SHOW_OPTION_NO; +#endif #ifdef HAVE_CRYPT have_crypt=SHOW_OPTION_YES; #else @@ -5463,6 +5491,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'V': print_version(); exit(0); + case 'W': + if (!argument) + global_system_variables.log_warnings++; + else if (argument == disabled_my_option) + global_system_variables.log_warnings= 0L; + else + global_system_variables.log_warnings= atoi(argument); + break; case 'T': test_flags= argument ? (uint) atoi(argument) : 0; test_flags&= ~TEST_NO_THREADS; diff --git a/sql/password.c b/sql/password.c index 49f149969c9..0ac91346a55 100644 --- a/sql/password.c +++ b/sql/password.c @@ -218,6 +218,8 @@ check_scramble_323(const char *scrambled, const char *message, to=buff; for (pos=scrambled ; *pos ; pos++) *to++=(char) (floor(my_rnd(&rand_st)*31)+64); + if (pos-scrambled != SCRAMBLE_LENGTH_323) + return 1; extra=(char) (floor(my_rnd(&rand_st)*31)); to=buff; while (*scrambled) diff --git a/sql/protocol.cc b/sql/protocol.cc index 44fc4eff9ad..7738349c742 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -26,6 +26,8 @@ #include "mysql_priv.h" #include +static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024; + #ifndef EMBEDDED_LIBRARY bool Protocol::net_store_data(const char *from, uint length) #else @@ -687,7 +689,7 @@ bool Protocol_simple::store_null() #endif char buff[1]; buff[0]= (char)251; - return packet->append(buff, sizeof(buff), PACKET_BUFFET_EXTRA_ALLOC); + return packet->append(buff, sizeof(buff), PACKET_BUFFER_EXTRA_ALLOC); } #endif @@ -990,7 +992,7 @@ bool Protocol_prep::store_tiny(longlong from) char buff[1]; field_pos++; buff[0]= (uchar) from; - return packet->append(buff, sizeof(buff), PACKET_BUFFET_EXTRA_ALLOC); + return packet->append(buff, sizeof(buff), PACKET_BUFFER_EXTRA_ALLOC); } @@ -1002,7 +1004,7 @@ bool Protocol_prep::store_short(longlong from) field_types[field_pos] == MYSQL_TYPE_YEAR); #endif field_pos++; - char *to= packet->prep_append(2, PACKET_BUFFET_EXTRA_ALLOC); + char *to= packet->prep_append(2, PACKET_BUFFER_EXTRA_ALLOC); if (!to) return 1; int2store(to, (int) from); @@ -1018,7 +1020,7 @@ bool Protocol_prep::store_long(longlong from) field_types[field_pos] == MYSQL_TYPE_LONG); #endif field_pos++; - char *to= packet->prep_append(4, PACKET_BUFFET_EXTRA_ALLOC); + char *to= packet->prep_append(4, PACKET_BUFFER_EXTRA_ALLOC); if (!to) return 1; int4store(to, from); @@ -1033,7 +1035,7 @@ bool Protocol_prep::store_longlong(longlong from, bool unsigned_flag) field_types[field_pos] == MYSQL_TYPE_LONGLONG); #endif field_pos++; - char *to= packet->prep_append(8, PACKET_BUFFET_EXTRA_ALLOC); + char *to= packet->prep_append(8, PACKET_BUFFER_EXTRA_ALLOC); if (!to) return 1; int8store(to, from); @@ -1048,7 +1050,7 @@ bool Protocol_prep::store(float from, uint32 decimals, String *buffer) field_types[field_pos] == MYSQL_TYPE_FLOAT); #endif field_pos++; - char *to= packet->prep_append(4, PACKET_BUFFET_EXTRA_ALLOC); + char *to= packet->prep_append(4, PACKET_BUFFER_EXTRA_ALLOC); if (!to) return 1; float4store(to, from); @@ -1063,7 +1065,7 @@ bool Protocol_prep::store(double from, uint32 decimals, String *buffer) field_types[field_pos] == MYSQL_TYPE_DOUBLE); #endif field_pos++; - char *to= packet->prep_append(8, PACKET_BUFFET_EXTRA_ALLOC); + char *to= packet->prep_append(8, PACKET_BUFFER_EXTRA_ALLOC); if (!to) return 1; float8store(to, from); @@ -1112,7 +1114,7 @@ bool Protocol_prep::store(TIME *tm) else length=0; buff[0]=(char) length; // Length is stored first - return packet->append(buff, length+1, PACKET_BUFFET_EXTRA_ALLOC); + return packet->append(buff, length+1, PACKET_BUFFER_EXTRA_ALLOC); } bool Protocol_prep::store_date(TIME *tm) @@ -1129,7 +1131,7 @@ bool Protocol_prep::store_time(TIME *tm) DBUG_ASSERT(field_types == 0 || field_types[field_pos] == MYSQL_TYPE_TIME); #endif - char buff[15],*pos; + char buff[13], *pos; uint length; field_pos++; pos= buff+1; @@ -1140,13 +1142,13 @@ bool Protocol_prep::store_time(TIME *tm) 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; // Length is stored first - return packet->append(buff, length+1, PACKET_BUFFET_EXTRA_ALLOC); + return packet->append(buff, length+1, PACKET_BUFFER_EXTRA_ALLOC); } #ifdef EMBEDDED_LIBRARY diff --git a/sql/protocol.h b/sql/protocol.h index 41885ec9f1f..43230983db7 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -18,7 +18,6 @@ #pragma interface /* gcc class implementation */ #endif -#define PACKET_BUFFET_EXTRA_ALLOC 1024 class i_string; class THD; diff --git a/sql/set_var.cc b/sql/set_var.cc index b3b0153652b..35bcbc9ce34 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -182,7 +182,7 @@ sys_var_key_cache_long sys_key_cache_age_threshold("key_cache_age_threshold", param_age_threshold)); sys_var_bool_ptr sys_local_infile("local_infile", &opt_local_infile); -sys_var_thd_bool sys_log_warnings("log_warnings", &SV::log_warnings); +sys_var_thd_ulong sys_log_warnings("log_warnings", &SV::log_warnings); sys_var_thd_ulong sys_long_query_time("long_query_time", &SV::long_query_time); sys_var_thd_bool sys_low_priority_updates("low_priority_updates", @@ -638,15 +638,18 @@ struct show_var_st init_vars[]= { {"ft_query_expansion_limit",(char*) &ft_query_expansion_limit, SHOW_LONG}, {"ft_stopword_file", (char*) &ft_stopword_file, SHOW_CHAR_PTR}, {sys_group_concat_max_len.name, (char*) &sys_group_concat_max_len, SHOW_SYS}, + {"have_archive", (char*) &have_archive_db, SHOW_HAVE}, {"have_bdb", (char*) &have_berkeley_db, SHOW_HAVE}, {"have_compress", (char*) &have_compress, SHOW_HAVE}, {"have_crypt", (char*) &have_crypt, SHOW_HAVE}, {"have_innodb", (char*) &have_innodb, SHOW_HAVE}, {"have_isam", (char*) &have_isam, SHOW_HAVE}, + {"have_geometry", (char*) &have_geometry, SHOW_HAVE}, {"have_ndbcluster", (char*) &have_ndbcluster, SHOW_HAVE}, {"have_openssl", (char*) &have_openssl, SHOW_HAVE}, {"have_query_cache", (char*) &have_query_cache, SHOW_HAVE}, {"have_raid", (char*) &have_raid, SHOW_HAVE}, + {"have_rtree_keys", (char*) &have_rtree_keys, SHOW_HAVE}, {"have_symlink", (char*) &have_symlink, SHOW_HAVE}, {"init_connect", (char*) &sys_init_connect, SHOW_SYS}, {"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR}, @@ -1708,19 +1711,31 @@ CHARSET_INFO *get_old_charset_by_name(const char *name) bool sys_var_collation::check(THD *thd, set_var *var) { CHARSET_INFO *tmp; - char buff[80]; - String str(buff,sizeof(buff), system_charset_info), *res; - if (!(res=var->value->val_str(&str))) + if (var->value->result_type() == STRING_RESULT) { - my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL"); - return 1; + char buff[80]; + String str(buff,sizeof(buff), system_charset_info), *res; + if (!(res=var->value->val_str(&str))) + { + my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL"); + return 1; + } + if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0)))) + { + my_error(ER_UNKNOWN_COLLATION, MYF(0), res->c_ptr()); + return 1; + } } - - if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0)))) + else // INT_RESULT { - my_error(ER_UNKNOWN_COLLATION, MYF(0), res->c_ptr()); - return 1; + if (!(tmp=get_charset(var->value->val_int(),MYF(0)))) + { + char buf[20]; + int10_to_str(var->value->val_int(), buf, -10); + my_error(ER_UNKNOWN_COLLATION, MYF(0), buf); + return 1; + } } var->save_result.charset= tmp; // Save for update return 0; @@ -1730,23 +1745,36 @@ bool sys_var_collation::check(THD *thd, set_var *var) bool sys_var_character_set::check(THD *thd, set_var *var) { CHARSET_INFO *tmp; - char buff[80]; - String str(buff,sizeof(buff), system_charset_info), *res; - if (!(res=var->value->val_str(&str))) - { - if (!nullable) + if (var->value->result_type() == STRING_RESULT) + { + char buff[80]; + String str(buff,sizeof(buff), system_charset_info), *res; + if (!(res=var->value->val_str(&str))) { - my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL"); + if (!nullable) + { + my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL"); + return 1; + } + tmp= NULL; + } + else if (!(tmp=get_charset_by_csname(res->c_ptr(),MY_CS_PRIMARY,MYF(0))) && + !(tmp=get_old_charset_by_name(res->c_ptr()))) + { + my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr()); return 1; } - tmp= NULL; } - else if (!(tmp=get_charset_by_csname(res->c_ptr(),MY_CS_PRIMARY,MYF(0))) && - !(tmp=get_old_charset_by_name(res->c_ptr()))) + else // INT_RESULT { - my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr()); - return 1; + if (!(tmp=get_charset(var->value->val_int(),MYF(0)))) + { + char buf[20]; + int10_to_str(var->value->val_int(), buf, -10); + my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), buf); + return 1; + } } var->save_result.charset= tmp; // Save for update return 0; @@ -1859,6 +1887,20 @@ void sys_var_character_set_server::set_default(THD *thd, enum_var_type type) } } +#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50000) +bool sys_var_character_set_server::check(THD *thd, set_var *var) +{ + if ((var->type == OPT_GLOBAL) && + (mysql_bin_log.is_open() || + active_mi->slave_running || active_mi->rli.slave_running)) + { + my_printf_error(0, "Binary logging and replication forbid changing \ +the global server character set or collation", MYF(0)); + return 1; + } + return sys_var_character_set::check(thd,var); +} +#endif CHARSET_INFO ** sys_var_character_set_database::ci_ptr(THD *thd, enum_var_type type) @@ -1952,6 +1994,20 @@ void sys_var_collation_database::set_default(THD *thd, enum_var_type type) } } +#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50000) +bool sys_var_collation_server::check(THD *thd, set_var *var) +{ + if ((var->type == OPT_GLOBAL) && + (mysql_bin_log.is_open() || + active_mi->slave_running || active_mi->rli.slave_running)) + { + my_printf_error(0, "Binary logging and replication forbid changing \ +the global server character set or collation", MYF(0)); + return 1; + } + return sys_var_collation::check(thd,var); +} +#endif bool sys_var_collation_server::update(THD *thd, set_var *var) { @@ -2524,6 +2580,36 @@ int sql_set_variables(THD *thd, List *var_list) } +/* + Say if all variables set by a SET support the ONE_SHOT keyword (currently, + only character set and collation do; later timezones will). + + SYNOPSIS + + not_all_support_one_shot + set_var List of variables to update + + NOTES + It has a "not_" because it makes faster tests (no need to "!") + + RETURN VALUE + 0 all variables of the list support ONE_SHOT + 1 at least one does not support ONE_SHOT +*/ + +bool not_all_support_one_shot(List *var_list) +{ + List_iterator_fast it(*var_list); + set_var_base *var; + while ((var= it++)) + { + if (var->no_support_one_shot()) + return 1; + } + return 0; +} + + /***************************************************************************** Functions to handle SET mysql_internal_variable=const_expr *****************************************************************************/ diff --git a/sql/set_var.h b/sql/set_var.h index 699f320bbd9..64bdfdb718b 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -49,10 +49,20 @@ public: const char *name; sys_after_update_func after_update; - sys_var(const char *name_arg) :name(name_arg),after_update(0) - {} +#if MYSQL_VERSION_ID < 50000 + bool no_support_one_shot; +#endif + sys_var(const char *name_arg) + :name(name_arg), after_update(0) +#if MYSQL_VERSION_ID < 50000 + , no_support_one_shot(1) +#endif + {} sys_var(const char *name_arg,sys_after_update_func func) - :name(name_arg),after_update(func) + :name(name_arg), after_update(func) +#if MYSQL_VERSION_ID < 50000 + , no_support_one_shot(1) +#endif {} virtual ~sys_var() {} virtual bool check(THD *thd, set_var *var); @@ -487,12 +497,17 @@ public: class sys_var_collation :public sys_var_thd { public: - sys_var_collation(const char *name_arg) :sys_var_thd(name_arg) {} + sys_var_collation(const char *name_arg) :sys_var_thd(name_arg) + { +#if MYSQL_VERSION_ID < 50000 + no_support_one_shot= 0; +#endif + } bool check(THD *thd, set_var *var); SHOW_TYPE type() { return SHOW_CHAR; } bool check_update_type(Item_result type) { - return type != STRING_RESULT; /* Only accept strings */ + return ((type != STRING_RESULT) && (type != INT_RESULT)); } bool check_default(enum_var_type type) { return 0; } virtual void set_default(THD *thd, enum_var_type type)= 0; @@ -502,13 +517,23 @@ class sys_var_character_set :public sys_var_thd { public: bool nullable; - sys_var_character_set(const char *name_arg) :sys_var_thd(name_arg) - { nullable= 0; } + sys_var_character_set(const char *name_arg) : + sys_var_thd(name_arg) + { + nullable= 0; +#if MYSQL_VERSION_ID < 50000 + /* + In fact only almost all variables derived from sys_var_character_set + support ONE_SHOT; character_set_results doesn't. But that's good enough. + */ + no_support_one_shot= 0; +#endif + } bool check(THD *thd, set_var *var); SHOW_TYPE type() { return SHOW_CHAR; } bool check_update_type(Item_result type) { - return type != STRING_RESULT; /* Only accept strings */ + return ((type != STRING_RESULT) && (type != INT_RESULT)); } bool check_default(enum_var_type type) { return 0; } bool update(THD *thd, set_var *var); @@ -541,6 +566,9 @@ class sys_var_character_set_server :public sys_var_character_set public: sys_var_character_set_server(const char *name_arg) : sys_var_character_set(name_arg) {} +#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50000) + bool check(THD *thd, set_var *var); +#endif void set_default(THD *thd, enum_var_type type); CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type); }; @@ -576,6 +604,9 @@ class sys_var_collation_server :public sys_var_collation { public: sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {} +#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50000) + bool check(THD *thd, set_var *var); +#endif bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); @@ -689,7 +720,10 @@ public: virtual int check(THD *thd)=0; /* To check privileges etc. */ virtual int update(THD *thd)=0; /* To set the value */ /* light check for PS */ - virtual int light_check(THD *thd) { return check(thd); } + virtual int light_check(THD *thd) { return check(thd); } +#if MYSQL_VERSION_ID < 50000 + virtual bool no_support_one_shot() { return 1; } +#endif }; @@ -731,6 +765,9 @@ public: int check(THD *thd); int update(THD *thd); int light_check(THD *thd); +#if MYSQL_VERSION_ID < 50000 + bool no_support_one_shot() { return var->no_support_one_shot; } +#endif }; @@ -833,6 +870,7 @@ void set_var_init(); void set_var_free(); sys_var *find_sys_var(const char *str, uint length=0); int sql_set_variables(THD *thd, List *var_list); +bool not_all_support_one_shot(List *var_list); void fix_delay_key_write(THD *thd, enum_var_type type); ulong fix_sql_mode(ulong sql_mode); extern sys_var_str sys_charset_system; diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 20a162a8080..b117587eb9c 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -255,7 +255,7 @@ character-set=latin2 "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 6b318256cd8..f49a6130299 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -257,7 +257,7 @@ character-set=latin1 "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 61558f7fae5..59011c802b6 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -246,7 +246,7 @@ character-set=latin1 "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 28da38a3691..122d8f990ab 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -251,7 +251,7 @@ character-set=latin7 "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 697cf5f7233..200edc44cd2 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -246,7 +246,7 @@ character-set=latin1 "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 3dc6aa34b5e..f33810c5496 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -258,7 +258,7 @@ character-set=latin1 "Schlüssel- und Tabellenverweis passen nicht zusammen", "Operand solle %d Spalte(n) enthalten", "Unterabfrage lieferte mehr als einen Datensatz zurück", -"Unbekannter Prepared-Statement-Handler (%ld) für %s angegeben", +"Unbekannter Prepared-Statement-Handler (%.*s) für %s angegeben", "Die Hilfe-Datenbank ist beschädigt oder existiert nicht", "Zyklischer Verweis in Unterabfragen", "Spalte '%s' wird von %s nach %s umgewandelt", diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index c5f122a2a49..2d742551b59 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -246,7 +246,7 @@ character-set=greek "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index e83f4ca5ca3..0b1a6fe2777 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -248,7 +248,7 @@ character-set=latin2 "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 294ff333e66..0f79ec8c953 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -246,7 +246,7 @@ character-set=latin1 "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 7969c3b35b8..375efc6dea0 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -248,7 +248,7 @@ character-set=ujis "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 132d4f121b2..7bbed0e9b0c 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -246,7 +246,7 @@ character-set=euckr "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 0416c4be926..8df547d38fe 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -248,7 +248,7 @@ character-set=latin1 "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index ef6c2ee05b2..262e67f4a6e 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -248,7 +248,7 @@ character-set=latin1 "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 348c9a07b8c..4c11ea0e73b 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -250,7 +250,7 @@ character-set=latin2 "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 3fe753a71cc..2175bee9474 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -247,7 +247,7 @@ character-set=latin1 "Referência da chave e referência da tabela não coincidem", "Operand should contain %d column(s)", "Subconsulta retorna mais que 1 registro", -"Desconhecido manipulador de declaração preparado (%ld) determinado para %s", +"Desconhecido manipulador de declaração preparado (%.*s) determinado para %s", "Banco de dado de ajuda corrupto ou não existente", "Referência cíclica em subconsultas", "Convertendo coluna '%s' de %s para %s", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index e9aa81717cb..78539c22d99 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -192,7 +192,7 @@ character-set=latin2 "Got error %d during FLUSH_LOGS", "Got error %d during CHECKPOINT", "Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: `%-.64s' (%-.64s)", -"The handler for the table does not support binary table dump","Binlog closed while trying to FLUSH MASTER", +"The handler for the table does not support binary table dump", "Binlog closed while trying to FLUSH MASTER", "Failed rebuilding the index of dumped table '%-.64s'", "Error from master: '%-.64s'", @@ -250,7 +250,7 @@ character-set=latin2 "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 8ed8aa03efb..7d7a1fd4a20 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -248,7 +248,7 @@ character-set=koi8r "Key reference and table reference doesn't match", "ïÐÅÒÁÎÄ ÄÏÌÖÅÎ ÓÏÄÅÒÖÁÔØ %d ËÏÌÏÎÏË", "ðÏÄÚÁÐÒÏÓ ×ÏÚ×ÒÁÝÁÅÔ ÂÏÌÅÅ ÏÄÎÏÊ ÚÁÐÉÓÉ", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "ãÉËÌÉÞÅÓËÁÑ ÓÓÙÌËÁ ÎÁ ÐÏÄÚÁÐÒÏÓ", "ðÒÅÏÂÒÁÚÏ×ÁÎÉÅ ÐÏÌÑ '%s' ÉÚ %s × %s", diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index b3718012ac3..051417b6c3d 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -236,6 +236,18 @@ character-set=cp1250 "Mešanje tabela koje podržavaju transakcije i onih koje ne podržavaju transakcije je iskljuèeno", "Opcija '%s' je upotrebljena dva puta u istom iskazu", "User '%-.64s' has exceeded the '%s' resource (current value: %ld)", +"Access denied. You need the %-.128s privilege for this operation", +"Variable '%-.64s' is a SESSION variable and can't be used with SET GLOBAL", +"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL", +"Variable '%-.64s' doesn't have a default value", +"Variable '%-.64s' can't be set to the value of '%-.64s'", +"Wrong argument type to variable '%-.64s'", +"Variable '%-.64s' can only be set, not read", +"Wrong usage/placement of '%s'", +"This version of MySQL doesn't yet support '%s'", +"Got fatal error %d: '%-.128s' from master when reading data from binary log", +"Slave SQL thread ignored the query because of replicate-*-table rules", +"Variable '%-.64s' is a %s variable", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", "Operand should contain %d column(s)", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 274f5ffa428..9160d2f7a91 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -254,7 +254,7 @@ character-set=latin2 "Key reference and table reference doesn't match", "Operand should contain %d column(s)", "Subquery returns more than 1 row", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", "Converting column '%s' from %s to %s", diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 5e3007d2b4e..5f2435feb1c 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -248,7 +248,7 @@ character-set=latin1 "Referencia de llave y referencia de tabla no coinciden", "Operando debe tener %d columna(s)", "Subconsulta retorna mas que 1 línea", -"Desconocido preparado comando handler (%ld) dado para %s", +"Desconocido preparado comando handler (%.*s) dado para %s", "Base de datos Help está corrupto o no existe", "Cíclica referencia en subconsultas", "Convirtiendo columna '%s' de %s para %s", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 516e53fe34d..f045bae4cf6 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -246,7 +246,7 @@ character-set=latin1 "Nyckelreferensen och tabellreferensen stämmer inte överens", "Operand should contain %d column(s)", "Subquery returnerade mer än 1 rad", -"Okänd PREPARED STATEMENT id (%ld) var given till %s", +"Okänd PREPARED STATEMENT id (%.*s) var given till %s", "Hjälpdatabasen finns inte eller är skadad", "Cyklisk referens i subqueries", "Konvertar kolumn '%s' från %s till %s", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index cf81afa8a5b..47b003894bd 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -251,7 +251,7 @@ character-set=koi8u "Key reference and table reference doesn't match", "ïÐÅÒÁÎÄ ÍÁ¤ ÓËÌÁÄÁÔÉÓÑ Ú %d ÓÔÏ×Âæ×", "ð¦ÄÚÁÐÉÔ ÐÏ×ÅÒÔÁ¤ ¦ÌØÛ ÎiÖ 1 ÚÁÐÉÓ", -"Unknown prepared statement handler (%ld) given to %s", +"Unknown prepared statement handler (%.*s) given to %s", "Help database is corrupt or does not exist", "ãÉË̦ÞÎÅ ÐÏÓÉÌÁÎÎÑ ÎÁ ЦÄÚÁÐÉÔ", "ðÅÒÅÔ×ÏÒÅÎÎÑ ÓÔÏ×ÂÃÁ '%s' Ú %s Õ %s", diff --git a/sql/slave.cc b/sql/slave.cc index fa17a192b12..a9b598d73db 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -72,7 +72,7 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed, static int request_table_dump(MYSQL* mysql, const char* db, const char* table); static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, const char* table_name, bool overwrite); -static int check_master_version_and_clock(MYSQL* mysql, MASTER_INFO* mi); +static int get_master_version_and_clock(MYSQL* mysql, MASTER_INFO* mi); /* @@ -1187,38 +1187,75 @@ slaves can't replicate a 5.0 or newer master."; break; } - MYSQL_RES *master_clock_res; - MYSQL_ROW master_clock_row; - time_t slave_clock; + /* + Compare the master and slave's clock. Do not die if master's clock is + unavailable (very old master not supporting UNIX_TIMESTAMP()?). + */ + MYSQL_RES *master_res= 0; + MYSQL_ROW master_row; + + if (!mysql_real_query(mysql, "SELECT UNIX_TIMESTAMP()", 23) && + (master_res= mysql_store_result(mysql)) && + (master_row= mysql_fetch_row(master_res))) + { + mi->clock_diff_with_master= + (long) (time((time_t*) 0) - strtoul(master_row[0], 0, 10)); + } + else + { + mi->clock_diff_with_master= 0; /* The "most sensible" value */ + sql_print_error("Warning: \"SELECT UNIX_TIMESTAMP()\" failed on master, \ +do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS"); + } + if (master_res) + mysql_free_result(master_res); + + /* + Check that the master's server id and ours are different. Because if they + are equal (which can result from a simple copy of master's datadir to slave, + thus copying some my.cnf), replication will work but all events will be + skipped. + Do not die if SHOW VARIABLES LIKE 'SERVER_ID' fails on master (very old + master?). + Note: we could have put a @@SERVER_ID in the previous SELECT + UNIX_TIMESTAMP() instead, but this would not have worked on 3.23 masters. + */ + if (!mysql_real_query(mysql, "SHOW VARIABLES LIKE 'SERVER_ID'", 31) && + (master_res= mysql_store_result(mysql))) + { + if ((master_row= mysql_fetch_row(master_res)) && + (::server_id == strtoul(master_row[1], 0, 10)) && + !replicate_same_server_id) + errmsg= "The slave I/O thread stops because master and slave have equal \ +MySQL server ids; these ids must be different for replication to work (or \ +the --replicate-same-server-id option must be used on slave but this does \ +not always make sense; please check the manual before using it)."; + mysql_free_result(master_res); + } - if (mysql_real_query(mysql, "SELECT UNIX_TIMESTAMP()", 23)) - errmsg= "\"SELECT UNIX_TIMESTAMP()\" failed on master"; - else if (!(master_clock_res= mysql_store_result(mysql))) + /* + Check that the master's global character_set_server and ours are the same. + Not fatal if query fails (old master?). + */ + if (!mysql_real_query(mysql, "SELECT @@GLOBAL.COLLATION_SERVER", 32) && + (master_res= mysql_store_result(mysql))) { - errmsg= "Could not read the result of \"SELECT UNIX_TIMESTAMP()\" on \ -master"; - } - else - { - if (!(master_clock_row= mysql_fetch_row(master_clock_res))) - errmsg= "Could not read a row from the result of \"SELECT \ -UNIX_TIMESTAMP()\" on master"; - else - { - slave_clock= time((time_t*) 0); - mi->clock_diff_with_master= (long) (slave_clock - - strtoul(master_clock_row[0], 0, 10)); - DBUG_PRINT("info",("slave_clock=%lu, master_clock=%s", - slave_clock, master_clock_row[0])); - } - mysql_free_result(master_clock_res); + if ((master_row= mysql_fetch_row(master_res)) && + strcmp(master_row[0], global_system_variables.collation_server->name)) + errmsg= "The slave I/O thread stops because master and slave have \ +different values for the COLLATION_SERVER global variable. The values must \ +be equal for replication to work"; + mysql_free_result(master_res); } + /* Add a timezones check here */ + if (errmsg) { sql_print_error(errmsg); return 1; } + return 0; } @@ -1386,7 +1423,7 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name, thd->net.no_send_ok = 0; // Clear up garbage after create_table_from_dump if (!called_connected) mysql_close(mysql); - if (errmsg && thd->net.vio) + if (errmsg && thd->vio_ok()) send_error(thd, error, errmsg); DBUG_RETURN(test(error)); // Return 1 on error } diff --git a/sql/spatial.cc b/sql/spatial.cc index 9769f6e7ca9..0668dd2faab 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -398,7 +398,7 @@ bool Gis_line_string::init_from_wkt(Gis_read_stream *trs, String *wkb) if (trs->skip_char(',')) // Didn't find ',' break; } - if (n_points < 2) + if (n_points < 1) { trs->set_error_msg("Too few points in LINESTRING"); return 1; @@ -487,6 +487,11 @@ int Gis_line_string::is_closed(int *closed) const if (no_data(data, 4)) return 1; n_points= uint4korr(data); + if (n_points == 1) + { + *closed=1; + return 0; + } data+= 4; if (no_data(data, SIZEOF_STORED_DOUBLE * 2 * n_points)) return 1; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 25ff4c5676b..9d1eb7bc54d 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -629,10 +629,10 @@ int acl_getroot(THD *thd, USER_RESOURCES *mqh, if (passwd_len == acl_user_tmp->salt_len) { if (acl_user_tmp->salt_len == 0 || - acl_user_tmp->salt_len == SCRAMBLE_LENGTH && - check_scramble(passwd, thd->scramble, acl_user_tmp->salt) == 0 || + (acl_user_tmp->salt_len == SCRAMBLE_LENGTH ? + check_scramble(passwd, thd->scramble, acl_user_tmp->salt) : check_scramble_323(passwd, thd->scramble, - (ulong *) acl_user_tmp->salt) == 0) + (ulong *) acl_user_tmp->salt)) == 0) { acl_user= acl_user_tmp; res= 0; @@ -941,7 +941,7 @@ static void acl_insert_db(const char *user, const char *host, const char *db, */ ulong acl_get(const char *host, const char *ip, - const char *user, const char *db, my_bool db_is_pattern) + const char *user, const char *db, my_bool db_is_pattern) { ulong host_access,db_access; uint i,key_length; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 9d368db0229..704662fa4bf 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -78,7 +78,6 @@ extern "C" void free_user_var(user_var_entry *entry) my_free((char*) entry,MYF(0)); } - bool key_part_spec::operator==(const key_part_spec& other) const { return length == other.length && !strcmp(field_name, other.field_name); @@ -181,6 +180,7 @@ THD::THD():user_time(0), current_statement(0), is_fatal_error(0), current_linfo = 0; slave_thread = 0; variables.pseudo_thread_id= 0; + one_shot_set= 0; file_id = 0; warn_id= 0; db_charset= global_system_variables.collation_database; @@ -746,7 +746,7 @@ bool select_send::send_data(List &items) } } thd->sent_row_count++; - if (!thd->net.vio) + if (!thd->vio_ok()) DBUG_RETURN(0); if (!thd->net.report_error) DBUG_RETURN(protocol->write()); @@ -1301,6 +1301,7 @@ Statement::Statement(THD *thd) query_length(0), free_list(0) { + name.str= NULL; init_sql_alloc(&mem_root, thd->variables.query_alloc_block_size, thd->variables.query_prealloc_size); @@ -1384,17 +1385,52 @@ static void delete_statement_as_hash_key(void *key) delete (Statement *) key; } +static byte *get_stmt_name_hash_key(Statement *entry, uint *length, + my_bool not_used __attribute__((unused))) +{ + *length=(uint) entry->name.length; + return (byte*) entry->name.str; +} + C_MODE_END Statement_map::Statement_map() : last_found_statement(0) { - enum { START_HASH_SIZE = 16 }; - hash_init(&st_hash, default_charset_info, START_HASH_SIZE, 0, 0, + enum + { + START_STMT_HASH_SIZE = 16, + START_NAME_HASH_SIZE = 16 + }; + hash_init(&st_hash, default_charset_info, START_STMT_HASH_SIZE, 0, 0, get_statement_id_as_hash_key, delete_statement_as_hash_key, MYF(0)); + hash_init(&names_hash, &my_charset_bin, START_NAME_HASH_SIZE, 0, 0, + (hash_get_key) get_stmt_name_hash_key, + NULL,MYF(0)); } +int Statement_map::insert(Statement *statement) +{ + int rc= my_hash_insert(&st_hash, (byte *) statement); + if (rc == 0) + last_found_statement= statement; + if (statement->name.str) + { + /* + If there is a statement with the same name, remove it. It is ok to + remove old and fail to insert new one at the same time. + */ + Statement *old_stmt; + if ((old_stmt= find_by_name(&statement->name))) + erase(old_stmt); + if ((rc= my_hash_insert(&names_hash, (byte*)statement))) + hash_delete(&st_hash, (byte*)statement); + } + return rc; +} + + bool select_dumpvar::send_data(List &items) { List_iterator_fast li(vars); diff --git a/sql/sql_class.h b/sql/sql_class.h index d787dcabd00..e9ad659a2cc 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -383,6 +383,7 @@ struct system_variables ulong query_prealloc_size; ulong trans_alloc_block_size; ulong trans_prealloc_size; + ulong log_warnings; ulong group_concat_max_len; /* In slave thread we need to know in behalf of which @@ -390,7 +391,6 @@ struct system_variables */ ulong pseudo_thread_id; - my_bool log_warnings; my_bool low_priority_updates; my_bool new_mode; my_bool query_cache_wlock_invalidate; @@ -461,6 +461,7 @@ public: */ bool allow_sum_func; + LEX_STRING name; /* name for named prepared statements */ LEX *lex; // parse tree descriptor /* Points to the query associated with this statement. It's const, but @@ -527,8 +528,14 @@ public: /* - Used to seek all existing statements in the connection - Deletes all statements in destructor. + Container for all statements created/used in a connection. + Statements in Statement_map have unique Statement::id (guaranteed by id + assignment in Statement::Statement) + Non-empty statement names are unique too: attempt to insert a new statement + with duplicate name causes older statement to be deleted + + Statements are auto-deleted when they are removed from the map and when the + map is deleted. */ class Statement_map @@ -536,34 +543,47 @@ class Statement_map public: Statement_map(); - int insert(Statement *statement) + int insert(Statement *statement); + + Statement *find_by_name(LEX_STRING *name) { - int rc= my_hash_insert(&st_hash, (byte *) statement); - if (rc == 0) - last_found_statement= statement; - return rc; + Statement *stmt; + stmt= (Statement*)hash_search(&names_hash, (byte*)name->str, + name->length); + return stmt; } Statement *find(ulong id) { if (last_found_statement == 0 || id != last_found_statement->id) - last_found_statement= (Statement *) hash_search(&st_hash, (byte *) &id, - sizeof(id)); + { + Statement *stmt; + stmt= (Statement *) hash_search(&st_hash, (byte *) &id, sizeof(id)); + if (stmt->name.str) + return NULL; + last_found_statement= stmt; + } return last_found_statement; } void erase(Statement *statement) { if (statement == last_found_statement) last_found_statement= 0; + if (statement->name.str) + { + hash_delete(&names_hash, (byte *) statement); + } hash_delete(&st_hash, (byte *) statement); } ~Statement_map() { hash_free(&st_hash); + hash_free(&names_hash); } private: HASH st_hash; + HASH names_hash; Statement *last_found_statement; }; @@ -801,7 +821,7 @@ public: /* scramble - random string sent to client on handshake */ char scramble[SCRAMBLE_LENGTH+1]; - bool slave_thread; + bool slave_thread, one_shot_set; bool locked, some_tables_deleted; bool last_cuted_field; bool no_errors, password, is_fatal_error; @@ -932,8 +952,10 @@ public: net.last_errno= 0; net.report_error= 0; } + inline bool vio_ok() const { return net.vio != 0; } #else void clear_error(); + inline bool vio_ok() const { return true; } #endif inline void fatal_error() { diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 48c355b6cd9..9db2198268a 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -358,15 +358,25 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) { error= -1; my_error(ER_DB_DROP_EXISTS,MYF(0),db); + goto exit; } else - { push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_DB_DROP_EXISTS, ER(ER_DB_DROP_EXISTS), db); - if (!silent) - send_ok(thd,0); + } + else + { + pthread_mutex_lock(&LOCK_open); + remove_db_from_cache(db); + pthread_mutex_unlock(&LOCK_open); + + error= -1; + if ((deleted= mysql_rm_known_files(thd, dirp, db, path, 0)) >= 0) + { + ha_drop_database(path); + query_cache_invalidate1(db); + error = 0; } - goto exit; } if (lower_case_table_names) { @@ -375,42 +385,30 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) my_casedn_str(files_charset_info, tmp_db); db= tmp_db; } - - pthread_mutex_lock(&LOCK_open); - remove_db_from_cache(db); - pthread_mutex_unlock(&LOCK_open); - - error = -1; - if ((deleted=mysql_rm_known_files(thd, dirp, db, path,0)) >= 0 && thd) + if (!silent && deleted>=0 && thd) { - ha_drop_database(path); - query_cache_invalidate1(db); - if (!silent) + const char *query; + ulong query_length; + if (!thd->query) { - const char *query; - ulong query_length; - if (!thd->query) - { - /* The client used the old obsolete mysql_drop_db() call */ - query= path; - query_length = (uint) (strxmov(path,"drop database `", db, "`", - NullS)- path); - } - else - { - query=thd->query; - query_length=thd->query_length; - } - mysql_update_log.write(thd, query, query_length); - if (mysql_bin_log.is_open()) - { - Query_log_event qinfo(thd, query, query_length, 0); - thd->clear_error(); - mysql_bin_log.write(&qinfo); - } - send_ok(thd,(ulong) deleted); + /* The client used the old obsolete mysql_drop_db() call */ + query= path; + query_length= (uint) (strxmov(path, "drop database `", db, "`", + NullS) - path); } - error = 0; + else + { + query =thd->query; + query_length= thd->query_length; + } + mysql_update_log.write(thd, query, query_length); + if (mysql_bin_log.is_open()) + { + Query_log_event qinfo(thd, query, query_length, 0); + thd->clear_error(); + mysql_bin_log.write(&qinfo); + } + send_ok(thd, (ulong) deleted); } exit: diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index f21dbb10712..48497636186 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -199,7 +199,15 @@ cleanup: transactional_table= table->file->has_transactions(); log_delayed= (transactional_table || table->tmp_table); - if (deleted && (error <= 0 || !transactional_table)) + /* + We write to the binary log even if we deleted no row, because maybe the + user is using this command to ensure that a table is clean on master *and + on slave*. Think of the case of a user having played separately with the + master's table and slave's table and wanting to take a fresh identical + start now. + error < 0 means "really no error". error <= 0 means "maybe some error". + */ + if ((deleted || (error < 0)) && (error <= 0 || !transactional_table)) { mysql_update_log.write(thd,thd->query, thd->query_length); if (mysql_bin_log.is_open()) @@ -544,6 +552,8 @@ bool multi_delete::send_eof() rows and we succeeded, or also in an error case when there was a non-transaction-safe table involved, since modifications in it cannot be rolled back. + Note that if we deleted nothing we don't write to the binlog (TODO: + fix this). */ if (deleted && (error <= 0 || normal_tables)) { diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 5b1b18e80e4..037dd99d3b6 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1199,7 +1199,8 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg) /* request for new delayed insert */ if (!(thd->lock=mysql_lock_tables(thd,&di->table,1))) { - di->dead=thd->killed=1; // Fatal error + di->dead= 1; // Some fatal error + thd->killed= 1; } pthread_cond_broadcast(&di->cond_client); } @@ -1207,7 +1208,8 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg) { if (di->handle_inserts()) { - di->dead=thd->killed=1; // Some fatal error + di->dead= 1; // Some fatal error + thd->killed= 1; } } di->status=0; @@ -1234,7 +1236,8 @@ end: close_thread_tables(thd); // Free the table di->table=0; - di->dead=thd->killed=1; // If error + di->dead= 1; // If error + thd->killed= 1; pthread_cond_broadcast(&di->cond_client); // Safety pthread_mutex_unlock(&di->mutex); diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 92ed53cf814..36e05b40c7d 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -76,6 +76,7 @@ enum enum_sql_command { SQLCOM_SHOW_COLUMN_TYPES, SQLCOM_SHOW_STORAGE_ENGINES, SQLCOM_SHOW_PRIVILEGES, SQLCOM_HELP, SQLCOM_DROP_USER, SQLCOM_REVOKE_ALL, SQLCOM_CHECKSUM, + SQLCOM_PREPARE, SQLCOM_EXECUTE, SQLCOM_DEALLOCATE_PREPARE, /* This should be the last !!! */ SQLCOM_END }; @@ -611,11 +612,22 @@ typedef struct st_lex uint fk_delete_opt, fk_update_opt, fk_match_option; uint slave_thd_opt; uint8 describe; - bool drop_if_exists, drop_temporary, local_file; + bool drop_if_exists, drop_temporary, local_file, one_shot_set; bool in_comment, ignore_space, verbose, no_write_to_binlog; bool derived_tables; bool safe_to_cache_query; ALTER_INFO alter_info; + /* Prepared statements SQL syntax:*/ + LEX_STRING prepared_stmt_name; /* Statement name (in all queries) */ + /* + Prepared statement query text or name of variable that holds the + prepared statement (in PREPARE ... queries) + */ + LEX_STRING prepared_stmt_code; + /* If true, prepared_stmt_code is a name of variable that holds the query */ + bool prepared_stmt_code_is_varref; + /* Names of user variables holding parameters (in EXECUTE) */ + List prepared_stmt_params; st_lex() {} inline void uncacheable(uint8 cause) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7596e37de93..384d05ad94e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1021,7 +1021,7 @@ pthread_handler_decl(handle_one_connection,arg) free_root(&thd->mem_root,MYF(0)); if (net->error && net->vio != 0 && net->report_error) { - if (!thd->killed && thd->variables.log_warnings) + if (!thd->killed && thd->variables.log_warnings > 1) sql_print_error(ER(ER_NEW_ABORTING_CONNECTION), thd->thread_id,(thd->db ? thd->db : "unconnected"), thd->user ? thd->user : "unauthenticated", @@ -1424,7 +1424,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd, } case COM_EXECUTE: { - thd->free_list= NULL; mysql_stmt_execute(thd, packet, packet_length); break; } @@ -1976,7 +1975,99 @@ mysql_execute_command(THD *thd) } break; } + case SQLCOM_PREPARE: + { + char *query_str; + uint query_len; + if (lex->prepared_stmt_code_is_varref) + { + /* This is PREPARE stmt FROM @var. */ + String str; + String *pstr; + CHARSET_INFO *to_cs= thd->variables.collation_connection; + bool need_conversion; + user_var_entry *entry; + uint32 unused; + /* + Convert @var contents to string in connection character set. Although + it is known that int/real/NULL value cannot be a valid query we still + convert it for error messages to uniform. + */ + if ((entry= + (user_var_entry*)hash_search(&thd->user_vars, + (byte*)lex->prepared_stmt_code.str, + lex->prepared_stmt_code.length)) + && entry->value) + { + String *pstr; + my_bool is_var_null; + pstr= entry->val_str(&is_var_null, &str, NOT_FIXED_DEC); + DBUG_ASSERT(!is_var_null); + if (!pstr) + send_error(thd, ER_OUT_OF_RESOURCES); + DBUG_ASSERT(pstr == &str); + } + else + str.set("NULL", 4, &my_charset_latin1); + need_conversion= + String::needs_conversion(str.length(), str.charset(), to_cs, &unused); + query_len= need_conversion? (str.length() * to_cs->mbmaxlen) : + str.length(); + if (!(query_str= alloc_root(&thd->mem_root, query_len+1))) + send_error(thd, ER_OUT_OF_RESOURCES); + + if (need_conversion) + query_len= copy_and_convert(query_str, query_len, to_cs, str.ptr(), + str.length(), str.charset()); + else + memcpy(query_str, str.ptr(), str.length()); + query_str[query_len]= 0; + } + else + { + query_str= lex->prepared_stmt_code.str; + query_len= lex->prepared_stmt_code.length; + DBUG_PRINT("info", ("PREPARE: %.*s FROM '%.*s' \n", + lex->prepared_stmt_name.length, + lex->prepared_stmt_name.str, + query_len, query_str)); + } + thd->command= COM_PREPARE; + if (!mysql_stmt_prepare(thd, query_str, query_len + 1, + &lex->prepared_stmt_name)) + send_ok(thd, 0L, 0L, "Statement prepared"); + break; + } + case SQLCOM_EXECUTE: + { + DBUG_PRINT("info", ("EXECUTE: %.*s\n", + lex->prepared_stmt_name.length, + lex->prepared_stmt_name.str)); + mysql_sql_stmt_execute(thd, &lex->prepared_stmt_name); + lex->prepared_stmt_params.empty(); + break; + } + case SQLCOM_DEALLOCATE_PREPARE: + { + Statement* stmt; + DBUG_PRINT("info", ("DEALLOCATE PREPARE: %.*s\n", + lex->prepared_stmt_name.length, + lex->prepared_stmt_name.str)); + if ((stmt= thd->stmt_map.find_by_name(&lex->prepared_stmt_name))) + { + thd->stmt_map.erase(stmt); + send_ok(thd); + } + else + { + res= -1; + my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), + lex->prepared_stmt_name.length, lex->prepared_stmt_name.str, + "DEALLOCATE PREPARE"); + } + break; + } case SQLCOM_DO: if (tables && ((res= check_table_access(thd, SELECT_ACL, tables,0)) || (res= open_and_lock_tables(thd,tables)))) @@ -2918,14 +3009,31 @@ unsent_create_error: } case SQLCOM_SET_OPTION: + { + List *lex_var_list= &lex->var_list; if (tables && ((res= check_table_access(thd, SELECT_ACL, tables,0)) || (res= open_and_lock_tables(thd,tables)))) break; - if (!(res= sql_set_variables(thd, &lex->var_list))) + if (lex->one_shot_set && not_all_support_one_shot(lex_var_list)) + { + my_printf_error(0, "The SET ONE_SHOT syntax is reserved for \ +purposes internal to the MySQL server", MYF(0)); + res= -1; + break; + } + if (!(res= sql_set_variables(thd, lex_var_list))) + { + /* + If the previous command was a SET ONE_SHOT, we don't want to forget + about the ONE_SHOT property of that SET. So we use a |= instead of = . + */ + thd->one_shot_set|= lex->one_shot_set; send_ok(thd); + } if (thd->net.report_error) res= -1; break; + } case SQLCOM_UNLOCK_TABLES: unlock_locked_tables(thd); @@ -3377,6 +3485,29 @@ unsent_create_error: break; } thd->proc_info="query end"; // QQ + if (thd->one_shot_set) + { + /* + If this is a SET, do nothing. This is to allow mysqlbinlog to print + many SET commands (in this case we want the charset temp setting to + live until the real query). This is also needed so that SET + CHARACTER_SET_CLIENT... does not cancel itself immediately. + */ + if (lex->sql_command != SQLCOM_SET_OPTION) + { + thd->variables.character_set_client= + global_system_variables.character_set_client; + thd->variables.collation_connection= + global_system_variables.collation_connection; + thd->variables.collation_database= + global_system_variables.collation_database; + thd->variables.collation_server= + global_system_variables.collation_server; + thd->update_charset(); + /* Add timezone stuff here */ + thd->one_shot_set= 0; + } + } if (res < 0) send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN : 0); @@ -3401,7 +3532,6 @@ error: */ int check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables) - { if (check_access(thd, privilege, tables->db, &tables->grant.privilege,0,0)) return 1; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 23b87a41c1a..40107ebc637 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -91,16 +91,22 @@ public: bool get_longdata_error; #ifndef EMBEDDED_LIBRARY bool (*set_params)(Prepared_statement *st, uchar *data, uchar *data_end, - uchar *read_pos); + uchar *read_pos, String *expanded_query); #else - bool (*set_params_data)(Prepared_statement *st); + bool (*set_params_data)(Prepared_statement *st, String *expanded_query); #endif + bool (*set_params_from_vars)(Prepared_statement *stmt, + List& varnames, + String *expanded_query); public: Prepared_statement(THD *thd_arg); virtual ~Prepared_statement(); + void setup_set_params(); virtual Statement::Type type() const; }; +static void execute_stmt(THD *thd, Prepared_statement *stmt, + String *expanded_query, bool set_context); /****************************************************************************** Implementation @@ -129,7 +135,8 @@ find_prepared_statement(THD *thd, ulong id, const char *where, if (stmt == 0 || stmt->type() != Statement::PREPARED_STATEMENT) { - my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), id, where); + char llbuf[22]; + my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), 22, llstr(id, llbuf), where); if (se == SEND_ERROR) send_error(thd); return 0; @@ -210,7 +217,13 @@ static ulong get_param_length(uchar **packet, ulong len) if (len < 5) return 0; (*packet)+=9; // Must be 254 when here - /* TODO: why uint4korr here? (should be uint8korr) */ + /* + In our client-server protocol all numbers bigger than 2^24 + stored as 8 bytes with uint8korr. Here we always know that + parameter length is less than 2^4 so don't look at the second + 4 bytes. But still we need to obey the protocol hence 9 in the + assignment above. + */ return (ulong) uint4korr(pos+1); } #else @@ -326,20 +339,19 @@ static void set_param_time(Item_param *param, uchar **pos, ulong len) { uchar *to= *pos; TIME tm; - - /* TODO: why length is compared with 8 here? */ - tm.second_part= (length > 8 ) ? (ulong) sint4korr(to+7): 0; + tm.neg= (bool) to[0]; + day= (uint) sint4korr(to+1); /* Note, that though ranges of hour, minute and second are not checked here we rely on them being < 256: otherwise we'll get buffer overflow in make_{date,time} functions, which are called when time value is converted to string. */ - day= (uint) sint4korr(to+1); tm.hour= (uint) to[5] + day * 24; tm.minute= (uint) to[6]; tm.second= (uint) to[7]; + tm.second_part= (length > 8) ? (ulong) sint4korr(to+8) : 0; if (tm.hour > 838) { /* TODO: add warning 'Data truncated' here */ @@ -348,7 +360,6 @@ static void set_param_time(Item_param *param, uchar **pos, ulong len) tm.second= 59; } tm.day= tm.year= tm.month= 0; - tm.neg= (bool)to[0]; param->set_time(&tm, TIMESTAMP_TIME, MAX_TIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); @@ -359,14 +370,16 @@ static void set_param_time(Item_param *param, uchar **pos, ulong len) static void set_param_datetime(Item_param *param, uchar **pos, ulong len) { uint length; - + if ((length= get_param_length(pos, len)) >= 4) { uchar *to= *pos; TIME tm; - - tm.second_part= (length > 7 ) ? (ulong) sint4korr(to+7): 0; - + + tm.neg= 0; + tm.year= (uint) sint2korr(to); + tm.month= (uint) to[2]; + tm.day= (uint) to[3]; /* Note, that though ranges of hour, minute and second are not checked here we rely on them being < 256: otherwise @@ -380,11 +393,8 @@ static void set_param_datetime(Item_param *param, uchar **pos, ulong len) } 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; param->set_time(&tm, TIMESTAMP_DATETIME, MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); @@ -579,6 +589,7 @@ static void setup_one_conversion_function(THD *thd, Item_param *param, param->item_result_type= STRING_RESULT; } } + param->param_type= (enum enum_field_types) param_type; } #ifndef EMBEDDED_LIBRARY @@ -588,19 +599,20 @@ static void setup_one_conversion_function(THD *thd, Item_param *param, */ static bool insert_params_withlog(Prepared_statement *stmt, uchar *null_array, - uchar *read_pos, uchar *data_end) + uchar *read_pos, uchar *data_end, + String *query) { THD *thd= stmt->thd; Item_param **begin= stmt->param_array; Item_param **end= begin + stmt->param_count; uint32 length= 0; - String str, query; + String str; const String *res; DBUG_ENTER("insert_params_withlog"); - if (query.copy(stmt->query, stmt->query_length, default_charset_info)) + if (query->copy(stmt->query, stmt->query_length, default_charset_info)) DBUG_RETURN(1); for (Item_param **it= begin; it < end; ++it) @@ -621,20 +633,18 @@ static bool insert_params_withlog(Prepared_statement *stmt, uchar *null_array, if (param->convert_str_value(thd)) DBUG_RETURN(1); /* out of memory */ - if (query.replace(param->pos_in_query+length, 1, *res)) + if (query->replace(param->pos_in_query+length, 1, *res)) DBUG_RETURN(1); length+= res->length()-1; } - if (alloc_query(thd, (char *)query.ptr(), query.length()+1)) - DBUG_RETURN(1); - DBUG_RETURN(0); } static bool insert_params(Prepared_statement *stmt, uchar *null_array, - uchar *read_pos, uchar *data_end) + uchar *read_pos, uchar *data_end, + String *expanded_query) { Item_param **begin= stmt->param_array; Item_param **end= begin + stmt->param_count; @@ -699,7 +709,7 @@ static bool setup_conversion_functions(Prepared_statement *stmt, #else -static bool emb_insert_params(Prepared_statement *stmt) +static bool emb_insert_params(Prepared_statement *stmt, String *expanded_query) { THD *thd= stmt->thd; Item_param **it= stmt->param_array; @@ -732,20 +742,20 @@ static bool emb_insert_params(Prepared_statement *stmt) } -static bool emb_insert_params_withlog(Prepared_statement *stmt) +static bool emb_insert_params_withlog(Prepared_statement *stmt, String *query) { THD *thd= stmt->thd; Item_param **it= stmt->param_array; Item_param **end= it + stmt->param_count; MYSQL_BIND *client_param= thd->client_params; - String str, query; + String str; const String *res; uint32 length= 0; DBUG_ENTER("emb_insert_params_withlog"); - if (query.copy(stmt->query, stmt->query_length, default_charset_info)) + if (query->copy(stmt->query, stmt->query_length, default_charset_info)) DBUG_RETURN(1); for (; it < end; ++it, ++client_param) @@ -764,24 +774,122 @@ static bool emb_insert_params_withlog(Prepared_statement *stmt) *client_param->length : client_param->buffer_length); } - res= param->query_val_str(&str); - if (param->convert_str_value(thd)) - DBUG_RETURN(1); /* out of memory */ } - if (query.replace(param->pos_in_query+length, 1, *res)) + res= param->query_val_str(&str); + if (param->convert_str_value(thd)) + DBUG_RETURN(1); /* out of memory */ + + if (query->replace(param->pos_in_query+length, 1, *res)) DBUG_RETURN(1); + length+= res->length()-1; } - - if (alloc_query(thd, (char *) query.ptr(), query.length()+1)) - DBUG_RETURN(1); - DBUG_RETURN(0); } #endif /*!EMBEDDED_LIBRARY*/ +/* + Set prepared statement parameters from user variables. + SYNOPSIS + insert_params_from_vars() + stmt Statement + varnames List of variables. Caller must ensure that number of variables + in the list is equal to number of statement parameters + query Ignored +*/ + +static bool insert_params_from_vars(Prepared_statement *stmt, + List& varnames, + String *query __attribute__((unused))) +{ + Item_param **begin= stmt->param_array; + Item_param **end= begin + stmt->param_count; + user_var_entry *entry; + LEX_STRING *varname; + List_iterator var_it(varnames); + DBUG_ENTER("insert_params_from_vars"); + + for (Item_param **it= begin; it < end; ++it) + { + Item_param *param= *it; + varname= var_it++; + entry= (user_var_entry*)hash_search(&stmt->thd->user_vars, + (byte*) varname->str, + varname->length); + if (param->set_from_user_var(stmt->thd, entry) || + param->convert_str_value(stmt->thd)) + DBUG_RETURN(1); + } + DBUG_RETURN(0); +} + + +/* + Do the same as insert_params_from_vars but also construct query text for + binary log. + SYNOPSIS + insert_params_from_vars() + stmt Statement + varnames List of variables. Caller must ensure that number of variables + in the list is equal to number of statement parameters + query The query with parameter markers replaced with their values +*/ + +static bool insert_params_from_vars_with_log(Prepared_statement *stmt, + List& varnames, + String *query) +{ + Item_param **begin= stmt->param_array; + Item_param **end= begin + stmt->param_count; + user_var_entry *entry; + LEX_STRING *varname; + DBUG_ENTER("insert_params_from_vars"); + + List_iterator var_it(varnames); + String str; + const String *res; + uint32 length= 0; + if (query->copy(stmt->query, stmt->query_length, default_charset_info)) + DBUG_RETURN(1); + + for (Item_param **it= begin; it < end; ++it) + { + Item_param *param= *it; + varname= var_it++; + if (get_var_with_binlog(stmt->thd, *varname, &entry)) + DBUG_RETURN(1); + DBUG_ASSERT(entry); + + if (param->set_from_user_var(stmt->thd, entry)) + DBUG_RETURN(1); + /* Insert @'escaped-varname' instead of parameter in the query */ + char *buf, *ptr; + str.length(0); + if (str.reserve(entry->name.length*2+3)) + DBUG_RETURN(1); + + buf= str.c_ptr_quick(); + ptr= buf; + *ptr++= '@'; + *ptr++= '\''; + ptr+= + escape_string_for_mysql(&my_charset_utf8_general_ci, + ptr, entry->name.str, entry->name.length); + *ptr++= '\''; + str.length(ptr - buf); + + if (param->convert_str_value(stmt->thd)) + DBUG_RETURN(1); /* out of memory */ + + if (query->replace(param->pos_in_query+length, 1, str)) + DBUG_RETURN(1); + length+= str.length()-1; + } + DBUG_RETURN(0); +} + /* Validate INSERT statement: @@ -978,7 +1086,7 @@ static int mysql_test_delete(Prepared_statement *stmt, */ static int mysql_test_select(Prepared_statement *stmt, - TABLE_LIST *tables) + TABLE_LIST *tables, bool text_protocol) { THD *thd= stmt->thd; LEX *lex= stmt->lex; @@ -1010,7 +1118,7 @@ static int mysql_test_select(Prepared_statement *stmt, if (lex->describe) { - if (send_prep_stmt(stmt, 0)) + if (!text_protocol && send_prep_stmt(stmt, 0)) goto err; } else @@ -1024,14 +1132,16 @@ static int mysql_test_select(Prepared_statement *stmt, goto err_prep; } - if (send_prep_stmt(stmt, lex->select_lex.item_list.elements) || + if (!text_protocol) + { + if (send_prep_stmt(stmt, lex->select_lex.item_list.elements) || thd->protocol_simple.send_fields(&lex->select_lex.item_list, 0) #ifndef EMBEDDED_LIBRARY - || net_flush(&thd->net) + || net_flush(&thd->net) #endif - ) - goto err_prep; - + ) + goto err_prep; + } unit->cleanup(); } thd->free_temporary_memory_pool_for_ps_preparing(); @@ -1309,7 +1419,7 @@ static int mysql_test_insert_select(Prepared_statement *stmt, 0 success 1 error, sent to client */ -static int send_prepare_results(Prepared_statement *stmt) +static int send_prepare_results(Prepared_statement *stmt, bool text_protocol) { THD *thd= stmt->thd; LEX *lex= stmt->lex; @@ -1346,7 +1456,7 @@ static int send_prepare_results(Prepared_statement *stmt) break; case SQLCOM_SELECT: - if ((res= mysql_test_select(stmt, tables))) + if ((res= mysql_test_select(stmt, tables, text_protocol))) goto error; /* Statement and field info has already been sent */ DBUG_RETURN(0); @@ -1404,7 +1514,7 @@ static int send_prepare_results(Prepared_statement *stmt) goto error; } if (res == 0) - DBUG_RETURN(send_prep_stmt(stmt, 0)); + DBUG_RETURN(text_protocol? 0 : send_prep_stmt(stmt, 0)); error: if (res < 0) send_error(thd, thd->killed ? ER_SERVER_SHUTDOWN : 0); @@ -1445,20 +1555,36 @@ static bool init_param_array(Prepared_statement *stmt) /* - Parse the query and send the total number of parameters - and resultset metadata information back to client (if any), - without executing the query i.e. without any log/disk - writes. This will allow the queries to be re-executed - without re-parsing during execute. + Given a query string with parameter markers, create a Prepared Statement + from it and send PS info back to the client. + + SYNOPSIS + mysql_stmt_prepare() + packet query to be prepared + packet_length query string length, including ignored trailing NULL or + quote char. + name NULL or statement name. For unnamed statements binary PS + protocol is used, for named statements text protocol is + used. + RETURN + 0 OK, statement prepared successfully + other Error + + NOTES + This function parses the query and sends the total number of parameters + and resultset metadata information back to client (if any), without + executing the query i.e. without any log/disk writes. This allows the + queries to be re-executed without re-parsing during execute. - If parameter markers are found in the query, then store - the information using Item_param along with maintaining a - list in lex->param_array, so that a fast and direct - retrieval can be made without going through all field - items. + If parameter markers are found in the query, then store the information + using Item_param along with maintaining a list in lex->param_array, so + that a fast and direct retrieval can be made without going through all + field items. + */ -void mysql_stmt_prepare(THD *thd, char *packet, uint packet_length) +int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length, + LEX_STRING *name) { LEX *lex; Prepared_statement *stmt= new Prepared_statement(thd); @@ -1470,14 +1596,26 @@ void mysql_stmt_prepare(THD *thd, char *packet, uint packet_length) if (stmt == 0) { send_error(thd, ER_OUT_OF_RESOURCES); - DBUG_VOID_RETURN; + DBUG_RETURN(1); + } + + if (name) + { + stmt->name.length= name->length; + if (!(stmt->name.str= memdup_root(&stmt->mem_root, (byte*)name->str, + name->length))) + { + delete stmt; + send_error(thd, ER_OUT_OF_RESOURCES); + DBUG_RETURN(1); + } } if (thd->stmt_map.insert(stmt)) { delete stmt; send_error(thd, ER_OUT_OF_RESOURCES); - DBUG_VOID_RETURN; + DBUG_RETURN(1); } thd->stmt_backup.set_statement(thd); @@ -1494,7 +1632,7 @@ void mysql_stmt_prepare(THD *thd, char *packet, uint packet_length) /* Statement map deletes statement on erase */ thd->stmt_map.erase(stmt); send_error(thd, ER_OUT_OF_RESOURCES); - DBUG_VOID_RETURN; + DBUG_RETURN(1); } mysql_log.write(thd, COM_PREPARE, "%s", packet); @@ -1506,7 +1644,7 @@ void mysql_stmt_prepare(THD *thd, char *packet, uint packet_length) error= yyparse((void *)thd) || thd->is_fatal_error || init_param_array(stmt) || - send_prepare_results(stmt); + send_prepare_results(stmt, test(name)); /* restore to WAIT_PRIOR: QUERY_PRIOR is set inside alloc_query */ if (!(specialflag & SPECIAL_NO_PRIOR)) @@ -1522,10 +1660,12 @@ void mysql_stmt_prepare(THD *thd, char *packet, uint packet_length) { /* Statement map deletes statement on erase */ thd->stmt_map.erase(stmt); + stmt= NULL; /* error is sent inside yyparse/send_prepare_results */ } else { + stmt->setup_set_params(); SELECT_LEX *sl= stmt->lex->all_selects_list; /* Save WHERE clause pointers, because they may be changed during query @@ -1535,8 +1675,10 @@ void mysql_stmt_prepare(THD *thd, char *packet, uint packet_length) { sl->prep_where= sl->where; } + } - DBUG_VOID_RETURN; + + DBUG_RETURN(!stmt); } /* Reinit statement before execution */ @@ -1611,13 +1753,21 @@ static void reset_stmt_params(Prepared_statement *stmt) Executes previously prepared query. If there is any parameters, then replace markers with the data supplied from client, and then execute the query. - SYNOPSYS + SYNOPSIS mysql_stmt_execute() + thd Current thread + packet Query string + packet_length Query string length, including terminator character. */ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length) { ulong stmt_id= uint4korr(packet); + /* + Query text for binary log, or empty string if the query is not put into + binary log. + */ + String expanded_query; #ifndef EMBEDDED_LIBRARY uchar *packet_end= (uchar *) packet + packet_length - 1; #endif @@ -1625,7 +1775,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length) DBUG_ENTER("mysql_stmt_execute"); packet+= 9; /* stmt_id + 5 bytes of flags */ - + if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute", SEND_ERROR))) DBUG_VOID_RETURN; @@ -1639,15 +1789,13 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length) DBUG_VOID_RETURN; } - thd->stmt_backup.set_statement(thd); - thd->set_statement(stmt); - reset_stmt_for_execute(stmt); #ifndef EMBEDDED_LIBRARY if (stmt->param_count) { uchar *null_array= (uchar *) packet; if (setup_conversion_functions(stmt, (uchar **) &packet, packet_end) || - stmt->set_params(stmt, null_array, (uchar *) packet, packet_end)) + stmt->set_params(stmt, null_array, (uchar *) packet, packet_end, + &expanded_query)) goto set_params_data_err; } #else @@ -1656,41 +1804,16 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length) we set params, and also we don't need to parse packet. So we do it in one function. */ - if (stmt->param_count && stmt->set_params_data(stmt)) + if (stmt->param_count && stmt->set_params_data(stmt, &expanded_query)) goto set_params_data_err; #endif - - if (!(specialflag & SPECIAL_NO_PRIOR)) - my_pthread_setprio(pthread_self(),QUERY_PRIOR); - - /* - TODO: - Also, have checks on basic executions such as mysql_insert(), - mysql_delete(), mysql_update() and mysql_select() to not to - have re-check on setup_* and other things .. - */ thd->protocol= &thd->protocol_prep; // Switch to binary protocol - mysql_execute_command(thd); - thd->lex->unit.cleanup(); + execute_stmt(thd, stmt, &expanded_query, true); thd->protocol= &thd->protocol_simple; // Use normal protocol - - if (!(specialflag & SPECIAL_NO_PRIOR)) - my_pthread_setprio(pthread_self(), WAIT_PRIOR); - - cleanup_items(stmt->free_list); - reset_stmt_params(stmt); - close_thread_tables(thd); // to close derived tables - thd->set_statement(&thd->stmt_backup); - /* - Free Items that were created during this execution of the PS by query - optimizer. - */ - free_items(thd->free_list); DBUG_VOID_RETURN; set_params_data_err: reset_stmt_params(stmt); - thd->set_statement(&thd->stmt_backup); my_error(ER_WRONG_ARGUMENTS, MYF(0), "mysql_stmt_execute"); send_error(thd); DBUG_VOID_RETURN; @@ -1698,11 +1821,107 @@ set_params_data_err: /* - Reset a prepared statement in case there was a recoverable error. + Execute prepared statement using parameter values from + lex->prepared_stmt_params and send result to the client using text protocol. +*/ + +void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name) +{ + Prepared_statement *stmt; + /* + Query text for binary log, or empty string if the query is not put into + binary log. + */ + String expanded_query; + DBUG_ENTER("mysql_sql_stmt_execute"); + + if (!(stmt= (Prepared_statement*)thd->stmt_map.find_by_name(stmt_name))) + { + my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), stmt_name->length, + stmt_name->str, "EXECUTE"); + send_error(thd); + DBUG_VOID_RETURN; + } + + if (stmt->param_count != thd->lex->prepared_stmt_params.elements) + { + my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE"); + send_error(thd); + DBUG_VOID_RETURN; + } + + thd->free_list= NULL; + thd->stmt_backup.set_statement(thd); + thd->set_statement(stmt); + if (stmt->set_params_from_vars(stmt, + thd->stmt_backup.lex->prepared_stmt_params, + &expanded_query)) + { + my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE"); + send_error(thd); + } + execute_stmt(thd, stmt, &expanded_query, false); + DBUG_VOID_RETURN; +} + + +/* + Execute prepared statement. + SYNOPSIS + execute_stmt() + thd Current thread + stmt Statement to execute + expanded_query If binary log is enabled, query string with parameter + placeholders replaced with actual values. Otherwise empty + string. + NOTES + Caller must set parameter values and thd::protocol. + thd->free_list is assumed to be garbage. +*/ + +static void execute_stmt(THD *thd, Prepared_statement *stmt, + String *expanded_query, bool set_context) +{ + DBUG_ENTER("execute_stmt"); + if (set_context) + { + thd->free_list= NULL; + thd->stmt_backup.set_statement(thd); + thd->set_statement(stmt); + } + reset_stmt_for_execute(stmt); + + if (expanded_query->length() && + alloc_query(thd, (char *)expanded_query->ptr(), + expanded_query->length()+1)) + { + my_error(ER_OUTOFMEMORY, 0, expanded_query->length()); + DBUG_VOID_RETURN; + } + + if (!(specialflag & SPECIAL_NO_PRIOR)) + my_pthread_setprio(pthread_self(),QUERY_PRIOR); + mysql_execute_command(thd); + thd->lex->unit.cleanup(); + if (!(specialflag & SPECIAL_NO_PRIOR)) + my_pthread_setprio(pthread_self(), WAIT_PRIOR); + + /* Free Items that were created during this execution of the PS. */ + free_items(thd->free_list); + cleanup_items(stmt->free_list); + reset_stmt_params(stmt); + close_thread_tables(thd); // to close derived tables + thd->set_statement(&thd->stmt_backup); + DBUG_VOID_RETURN; +} + + +/* + Reset a prepared statement in case there was a recoverable error. SYNOPSIS mysql_stmt_reset() - thd Thread handle - packet Packet with stmt id + thd Thread handle + packet Packet with stmt id DESCRIPTION This function resets statement to the state it was right after prepare. @@ -1842,8 +2061,14 @@ Prepared_statement::Prepared_statement(THD *thd_arg) get_longdata_error(0) { *last_error= '\0'; - if (mysql_bin_log.is_open()) +} + +void Prepared_statement::setup_set_params() +{ + /* Setup binary logging */ + if (mysql_bin_log.is_open() && is_update_query(lex->sql_command)) { + set_params_from_vars= insert_params_from_vars_with_log; #ifndef EMBEDDED_LIBRARY set_params= insert_params_withlog; #else @@ -1851,14 +2076,16 @@ Prepared_statement::Prepared_statement(THD *thd_arg) #endif } else + { + set_params_from_vars= insert_params_from_vars; #ifndef EMBEDDED_LIBRARY set_params= insert_params; #else set_params_data= emb_insert_params; #endif + } } - Prepared_statement::~Prepared_statement() { free_items(free_list); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8d651c00a0a..f7a0d5259a6 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -933,7 +933,7 @@ JOIN::optimize() If having is not handled here, it will be checked before the row is sent to the client. */ - if (having && + if (tmp_having && (sort_and_group || (exec_tmp_table1->distinct && !group_list))) having= tmp_having; @@ -6369,7 +6369,8 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), if ((join->tables == 1) && !join->tmp_table && !join->sort_and_group && !join->send_group_parts && !join->having && !jt->select_cond && !(jt->select && jt->select->quick) && - !(jt->table->file->table_flags() & HA_NOT_EXACT_COUNT)) + !(jt->table->file->table_flags() & HA_NOT_EXACT_COUNT) && + (jt->ref.key < 0)) { /* Join over all rows in table; Return number of found rows */ TABLE *table=jt->table; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a54a6fa1a4c..0b565968b08 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1251,7 +1251,7 @@ store_create_info(THD *thd, TABLE *table, String *packet) packet->append(' '); // check for surprises from the previous call to Field::sql_type() if (type.ptr() != tmp) - type.set(tmp, sizeof(tmp),&my_charset_bin); + type.set(tmp, sizeof(tmp), system_charset_info); field->sql_type(type); packet->append(type.ptr(), type.length(), system_charset_info); @@ -1540,13 +1540,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) while ((tmp=it++)) { struct st_my_thread_var *mysys_var; -#ifndef EMBEDDED_LIBRARY - if ((tmp->net.vio || tmp->system_thread) && + if ((tmp->vio_ok() || tmp->system_thread) && (!user || (tmp->user && !strcmp(tmp->user,user)))) -#else - if (tmp->system_thread && - (!user || (tmp->user && !strcmp(tmp->user,user)))) -#endif { thread_info *thd_info=new thread_info; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 8682b98a69a..bdff1f52d04 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -254,7 +254,17 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, } } thd->tmp_table_used= tmp_table_deleted; - if (some_tables_deleted || tmp_table_deleted) + error= 0; + if (wrong_tables.length()) + { + if (!foreign_key_error) + my_error(ER_BAD_TABLE_ERROR,MYF(0), wrong_tables.c_ptr()); + else + my_error(ER_ROW_IS_REFERENCED, MYF(0)); + error= 1; + } + + if (some_tables_deleted || tmp_table_deleted || !error) { query_cache_invalidate3(thd, tables, 0); if (!dont_log_query) @@ -262,7 +272,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, mysql_update_log.write(thd, thd->query,thd->query_length); if (mysql_bin_log.is_open()) { - thd->clear_error(); + if (!error) + thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, tmp_table_deleted && !some_tables_deleted); mysql_bin_log.write(&qinfo); @@ -271,15 +282,6 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, } unlock_table_names(thd, tables); - error= 0; - if (wrong_tables.length()) - { - if (!foreign_key_error) - my_error(ER_BAD_TABLE_ERROR,MYF(0),wrong_tables.c_ptr()); - else - my_error(ER_ROW_IS_REFERENCED,MYF(0)); - error= 1; - } DBUG_RETURN(error); } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 2428aac2da5..9436db6c3b9 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -331,7 +331,7 @@ int mysql_update(THD *thd, transactional_table= table->file->has_transactions(); log_delayed= (transactional_table || table->tmp_table); - if (updated && (error <= 0 || !transactional_table)) + if ((updated || (error < 0)) && (error <= 0 || !transactional_table)) { mysql_update_log.write(thd,thd->query,thd->query_length); if (mysql_bin_log.is_open()) @@ -1092,7 +1092,9 @@ bool multi_update::send_eof() /* Write the SQL statement to the binlog if we updated rows and we succeeded or if we updated some non - transacational tables + transacational tables. + Note that if we updated nothing we don't write to the binlog (TODO: + fix this). */ if (updated && (local_error <= 0 || !trans_safe)) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 6a40dc3c23a..89915852b9b 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -316,6 +316,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token NUM %token OFFSET_SYM %token ON +%token ONE_SHOT_SYM %token OPEN_SYM %token OPTION %token OPTIONALLY @@ -432,6 +433,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token MEDIUMTEXT %token NUMERIC_SYM %token PRECISION +%token PREPARE_SYM +%token DEALLOCATE_SYM %token QUICK %token REAL %token SIGNED_SYM @@ -724,6 +727,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); precision subselect_start opt_and charset subselect_end select_var_list select_var_list_init help opt_len opt_extended_describe + prepare prepare_src execute deallocate END_OF_INPUT %type @@ -760,10 +764,12 @@ verb_clause: | checksum | commit | create + | deallocate | delete | describe | do | drop + | execute | flush | grant | handler @@ -775,6 +781,7 @@ verb_clause: | optimize | keycache | preload + | prepare | purge | rename | repair @@ -795,6 +802,86 @@ verb_clause: | use ; +deallocate: + DEALLOCATE_SYM PREPARE_SYM ident + { + THD *thd=YYTHD; + LEX *lex= thd->lex; + if (thd->command == COM_PREPARE) + { + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; + } + lex->sql_command= SQLCOM_DEALLOCATE_PREPARE; + lex->prepared_stmt_name= $3; + }; + +prepare: + PREPARE_SYM ident FROM prepare_src + { + THD *thd=YYTHD; + LEX *lex= thd->lex; + if (thd->command == COM_PREPARE) + { + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; + } + lex->sql_command= SQLCOM_PREPARE; + lex->prepared_stmt_name= $2; + }; + +prepare_src: + TEXT_STRING_sys + { + THD *thd=YYTHD; + LEX *lex= thd->lex; + lex->prepared_stmt_code= $1; + lex->prepared_stmt_code_is_varref= false; + } + | '@' ident_or_text + { + THD *thd=YYTHD; + LEX *lex= thd->lex; + lex->prepared_stmt_code= $2; + lex->prepared_stmt_code_is_varref= true; + }; + +execute: + EXECUTE_SYM ident + { + THD *thd=YYTHD; + LEX *lex= thd->lex; + if (thd->command == COM_PREPARE) + { + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; + } + lex->sql_command= SQLCOM_EXECUTE; + lex->prepared_stmt_name= $2; + } + execute_using + {} + ; + +execute_using: + /* nothing */ + | USING execute_var_list + ; + +execute_var_list: + execute_var_list ',' execute_var_ident + | execute_var_ident + ; + +execute_var_ident: '@' ident_or_text + { + LEX *lex=Lex; + LEX_STRING *lexstr= (LEX_STRING*)sql_memdup(&$2, sizeof(LEX_STRING)); + if (!lexstr || lex->prepared_stmt_params.push_back(lexstr)) + YYABORT; + } + ; + /* help */ help: @@ -4768,7 +4855,7 @@ simple_ident: field_ident: ident { $$=$1;} - | ident '.' ident { $$=$3;} /* Skipp schema name in create*/ + | ident '.' ident { $$=$3;} /* Skip schema name in create*/ | '.' ident { $$=$2;} /* For Delphi */; table_ident: @@ -4911,6 +4998,7 @@ keyword: | DATETIME {} | DATE_SYM {} | DAY_SYM {} + | DEALLOCATE_SYM {} | DELAY_KEY_WRITE_SYM {} | DES_KEY_FILE {} | DIRECTORY_SYM {} @@ -5002,12 +5090,14 @@ keyword: | NVARCHAR_SYM {} | OFFSET_SYM {} | OLD_PASSWORD {} + | ONE_SHOT_SYM {} | OPEN_SYM {} | PACK_KEYS_SYM {} | PARTIAL {} | PASSWORD {} | POINT_SYM {} | POLYGON {} + | PREPARE_SYM {} | PREV_SYM {} | PROCESS {} | PROCESSLIST_SYM {} @@ -5088,6 +5178,7 @@ set: lex->sql_command= SQLCOM_SET_OPTION; lex->option_type=OPT_SESSION; lex->var_list.empty(); + lex->one_shot_set= 0; } option_value_list {} @@ -5106,6 +5197,7 @@ option_type: | GLOBAL_SYM { Lex->option_type= OPT_GLOBAL; } | LOCAL_SYM { Lex->option_type= OPT_SESSION; } | SESSION_SYM { Lex->option_type= OPT_SESSION; } + | ONE_SHOT_SYM { Lex->option_type= OPT_SESSION; Lex->one_shot_set= 1; } ; opt_var_type: diff --git a/sql/time.cc b/sql/time.cc index 6d15fa184a1..992f1afc4af 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -745,7 +745,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time) for (value=0; str != end && my_isdigit(&my_charset_latin1,*str) ; str++) value=value*10L + (long) (*str - '0'); - /* Skipp all space after 'days' */ + /* Skip all space after 'days' */ end_of_days= str; for (; str != end && my_isspace(&my_charset_latin1, str[0]) ; str++) ; diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 2071759ddae..7a3c4503d74 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -402,7 +402,7 @@ static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)), } if (*ptr == escape && ptr+1 != end) { - ptr++; /* Skipp escape */ + ptr++; /* Skip escape */ *min_str++= *max_str++ = *ptr; continue; } @@ -6313,6 +6313,7 @@ CHARSET_INFO my_charset_big5_chinese_ci= "big5", /* cs name */ "big5_chinese_ci", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_big5, to_lower_big5, to_upper_big5, @@ -6339,6 +6340,7 @@ CHARSET_INFO my_charset_big5_bin= "big5", /* cs name */ "big5_bin", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_big5, to_lower_big5, to_upper_big5, diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 7cac8c7c337..48323018cca 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -378,6 +378,7 @@ CHARSET_INFO my_charset_bin = "binary", /* cs name */ "binary", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_bin, /* ctype */ bin_char_array, /* to_lower */ bin_char_array, /* to_upper */ diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index 2eb2fac46e9..dede737f361 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -589,6 +589,7 @@ CHARSET_INFO my_charset_latin2_czech_ci = "latin2", /* cs name */ "latin2_czech_cs", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_czech, to_lower_czech, to_upper_czech, diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 8f955c15a73..2d4c68978a3 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8681,6 +8681,7 @@ CHARSET_INFO my_charset_euckr_korean_ci= "euckr", /* cs name */ "euckr_korean_ci", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_euc_kr, to_lower_euc_kr, to_upper_euc_kr, @@ -8707,6 +8708,7 @@ CHARSET_INFO my_charset_euckr_bin= "euckr", /* cs name */ "euckr_bin", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_euc_kr, to_lower_euc_kr, to_upper_euc_kr, diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index b76511fc4f3..49ca736a3c2 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -5732,6 +5732,7 @@ CHARSET_INFO my_charset_gb2312_chinese_ci= "gb2312", /* cs name */ "gb2312_chinese_ci",/* name */ "", /* comment */ + NULL, /* tailoring */ ctype_gb2312, to_lower_gb2312, to_upper_gb2312, @@ -5757,6 +5758,7 @@ CHARSET_INFO my_charset_gb2312_bin= "gb2312", /* cs name */ "gb2312_bin", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_gb2312, to_lower_gb2312, to_upper_gb2312, diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index cc0f226d01c..0273feb4c2c 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -2715,7 +2715,7 @@ static my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)), } if (*ptr == escape && ptr+1 != end) { - ptr++; /* Skipp escape */ + ptr++; /* Skip escape */ *min_str++= *max_str++ = *ptr; continue; } @@ -9962,6 +9962,7 @@ CHARSET_INFO my_charset_gbk_chinese_ci= "gbk", /* cs name */ "gbk_chinese_ci", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_gbk, to_lower_gbk, to_upper_gbk, @@ -9987,6 +9988,7 @@ CHARSET_INFO my_charset_gbk_bin= "gbk", /* cs name */ "gbk_bin", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_gbk, to_lower_gbk, to_upper_gbk, diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index 0b439964c7c..fe39303e2ac 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -412,6 +412,7 @@ CHARSET_INFO my_charset_latin1= "latin1", /* cs name */ "latin1_swedish_ci", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_latin1, to_lower_latin1, to_upper_latin1, @@ -690,6 +691,7 @@ CHARSET_INFO my_charset_latin1_german2_ci= "latin1", /* cs name */ "latin1_german2_ci", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_latin1, to_lower_latin1, to_upper_latin1, @@ -715,6 +717,7 @@ CHARSET_INFO my_charset_latin1_bin= "latin1", /* cs name */ "latin1_bin", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_latin1, to_lower_latin1, to_upper_latin1, diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 72666175a1f..22c58360348 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4579,6 +4579,7 @@ CHARSET_INFO my_charset_sjis_japanese_ci= "sjis", /* cs name */ "sjis_japanese_ci", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_sjis, to_lower_sjis, to_upper_sjis, @@ -4604,6 +4605,7 @@ CHARSET_INFO my_charset_sjis_bin= "sjis", /* cs name */ "sjis_bin", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_sjis, to_lower_sjis, to_upper_sjis, diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index 1b6b1edc8b9..b2b1ab98352 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -671,7 +671,7 @@ my_bool my_like_range_tis620(CHARSET_INFO *cs __attribute__((unused)), { if (*ptr == escape && ptr+1 != end) { - ptr++; /* Skipp escape */ + ptr++; /* Skip escape */ *min_str++ = *max_str++ = *ptr; continue; } @@ -951,6 +951,7 @@ CHARSET_INFO my_charset_tis620_thai_ci= "tis620", /* cs name */ "tis620_thai_ci", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_tis620, to_lower_tis620, to_upper_tis620, @@ -976,6 +977,7 @@ CHARSET_INFO my_charset_tis620_bin= "tis620", /* cs name */ "tis620_bin", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_tis620, to_lower_tis620, to_upper_tis620, diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 81073d47554..75e2c06eec2 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -7055,6 +7055,7 @@ CHARSET_INFO my_charset_ucs2_general_uca= "ucs2", /* cs name */ "ucs2_general_uca", /* name */ "", /* comment */ + NULL, /* tailoring */ NULL, /* ctype */ NULL, /* to_lower */ NULL, /* to_upper */ diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 67340fdd4f4..d1ba63b8b84 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1431,6 +1431,7 @@ CHARSET_INFO my_charset_ucs2_general_ci= "ucs2", /* cs name */ "ucs2_general_ci", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_ucs2, /* ctype */ to_lower_ucs2, /* to_lower */ to_upper_ucs2, /* to_upper */ @@ -1456,6 +1457,7 @@ CHARSET_INFO my_charset_ucs2_bin= "ucs2", /* cs name */ "ucs2_bin", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_ucs2, /* ctype */ to_lower_ucs2, /* to_lower */ to_upper_ucs2, /* to_upper */ diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index fd3692553be..668dc7beb8b 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8468,6 +8468,7 @@ CHARSET_INFO my_charset_ujis_japanese_ci= "ujis", /* cs name */ "ujis_japanese_ci", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_ujis, to_lower_ujis, to_upper_ujis, @@ -8494,6 +8495,7 @@ CHARSET_INFO my_charset_ujis_bin= "ujis", /* cs name */ "ujis_bin", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_ujis, to_lower_ujis, to_upper_ujis, diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 29d2c5d1358..2d0feb1c890 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1524,8 +1524,12 @@ MY_UNICASE_INFO *uni_plane[256]={ #ifdef HAVE_CHARSET_utf8 -/* These arrays are taken from usa7 implementation */ - +/* + We consider bytes with code more than 127 as a letter. + This garantees that word boundaries work fine with regular + expressions. Note, there is no need to mark byte 255 as a + letter, it is illegal byte in UTF8. +*/ static uchar ctype_utf8[] = { 0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, @@ -1536,16 +1540,18 @@ static uchar ctype_utf8[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16, 16,130,130,130,130,130,130, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0 }; +/* The below are taken from usa7 implementation */ + static uchar to_lower_utf8[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, @@ -2084,6 +2090,7 @@ CHARSET_INFO my_charset_utf8_general_ci= "utf8", /* cs name */ "utf8_general_ci", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_utf8, /* ctype */ to_lower_utf8, /* to_lower */ to_upper_utf8, /* to_upper */ @@ -2110,6 +2117,7 @@ CHARSET_INFO my_charset_utf8_bin= "utf8", /* cs name */ "utf8_bin", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_utf8, /* ctype */ to_lower_utf8, /* to_lower */ to_upper_utf8, /* to_upper */ diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index 2eefb570170..bb287eb695e 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -623,6 +623,7 @@ CHARSET_INFO my_charset_cp1250_czech_ci = "cp1250", /* cs name */ "cp1250_czech_cs", /* name */ "", /* comment */ + NULL, /* tailoring */ ctype_win1250ch, to_lower_win1250ch, to_upper_win1250ch, diff --git a/strings/ctype.c b/strings/ctype.c index cbd13111b70..4454d3c45e1 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -22,6 +22,23 @@ #endif +/* + + This files implements routines which parse XML based + character set and collation description files. + + Unicode collations are encoded according to + + Unicode Technical Standard #35 + Locale Data Markup Language (LDML) + http://www.unicode.org/reports/tr35/ + + and converted into ICU string according to + + Collation Customization + http://oss.software.ibm.com/icu/userguide/Collate_Customization.html + +*/ static char *mstr(char *str,const char *src,uint l1,uint l2) { @@ -54,6 +71,11 @@ struct my_cs_file_section_st #define _CS_PRIMARY_ID 15 #define _CS_BINARY_ID 16 #define _CS_CSDESCRIPT 17 +#define _CS_RESET 18 +#define _CS_DIFF1 19 +#define _CS_DIFF2 20 +#define _CS_DIFF3 21 + static struct my_cs_file_section_st sec[] = { @@ -83,6 +105,10 @@ static struct my_cs_file_section_st sec[] = {_CS_ORDER, "charsets.charset.collation.order"}, {_CS_FLAG, "charsets.charset.collation.flag"}, {_CS_COLLMAP, "charsets.charset.collation.map"}, + {_CS_RESET, "charsets.charset.collation.rules.reset"}, + {_CS_DIFF1, "charsets.charset.collation.rules.p"}, + {_CS_DIFF2, "charsets.charset.collation.rules.s"}, + {_CS_DIFF3, "charsets.charset.collation.rules.t"}, {0, NULL} }; @@ -98,6 +124,7 @@ static struct my_cs_file_section_st * cs_file_sec(const char *attr, uint len) } #define MY_CS_CSDESCR_SIZE 64 +#define MY_CS_TAILORING_SIZE 128 typedef struct my_cs_file_info { @@ -109,6 +136,8 @@ typedef struct my_cs_file_info uchar sort_order[MY_CS_SORT_ORDER_TABLE_SIZE]; uint16 tab_to_uni[MY_CS_TO_UNI_TABLE_SIZE]; char comment[MY_CS_CSDESCR_SIZE]; + char tailoring[MY_CS_TAILORING_SIZE]; + size_t tailoring_length; CHARSET_INFO cs; int (*add_collation)(CHARSET_INFO *cs); } MY_CHARSET_LOADER; @@ -156,9 +185,11 @@ static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len) struct my_cs_file_section_st *s= cs_file_sec(attr,len); if ( s && (s->state == _CS_CHARSET)) - { bzero(&i->cs,sizeof(i->cs)); - } + + if (s && (s->state == _CS_COLLATION)) + i->tailoring_length= 0; + return MY_XML_OK; } @@ -242,6 +273,26 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) fill_uchar(i->ctype,MY_CS_CTYPE_TABLE_SIZE,attr,len); i->cs.ctype=i->ctype; break; + case _CS_RESET: + case _CS_DIFF1: + case _CS_DIFF2: + case _CS_DIFF3: + { + /* + Convert collation description from + Locale Data Markup Language (LDML) + into ICU Collation Customization expression. + */ + char arg[16]; + const char *cmd[]= {"&","<","<<","<<<"}; + i->cs.tailoring= i->tailoring; + mstr(arg,attr,len,sizeof(arg)-1); + if (i->tailoring_length + 20 < sizeof(i->tailoring)) + { + char *dst= i->tailoring_length + i->tailoring; + i->tailoring_length+= sprintf(dst," %s %s",cmd[state-_CS_RESET],arg); + } + } } return MY_XML_OK; } diff --git a/tests/client_test.c b/tests/client_test.c index 1f80ecc9481..a2703478036 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -19,12 +19,6 @@ protocol Main author: venu ( venu@mysql.com ) - - NOTES: - - To be able to test which fields are used, we are not clearing - the MYSQL_BIND with bzero() but instead just clearing the fields that - are used by the API. - ***************************************************************************/ #include @@ -38,16 +32,16 @@ #define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */ /* set default options */ -static char *opt_db=0; -static char *opt_user=0; -static char *opt_password=0; -static char *opt_host=0; -static char *opt_unix_socket=0; +static char *opt_db= 0; +static char *opt_user= 0; +static char *opt_password= 0; +static char *opt_host= 0; +static char *opt_unix_socket= 0; static unsigned int opt_port; -static my_bool tty_password=0; +static my_bool tty_password= 0; -static MYSQL *mysql=0; -static char query[MAX_TEST_QUERY_LENGTH]; +static MYSQL *mysql= 0; +static char query[MAX_TEST_QUERY_LENGTH]; static char current_db[]= "client_test_db"; static unsigned int test_count= 0; static unsigned int opt_count= 0; @@ -56,20 +50,20 @@ static unsigned int iter_count= 0; static time_t start_time, end_time; static double total_time; -const char *default_dbug_option="d:t:o,/tmp/client_test.trace"; +const char *default_dbug_option= "d:t:o,/tmp/client_test.trace"; #define myheader(str) \ { \ - fprintf(stdout,"\n\n#####################################\n"); \ - fprintf(stdout,"%d of (%d/%d): %s",test_count++, iter_count,\ + fprintf(stdout, "\n\n#####################################\n"); \ + fprintf(stdout, "%d of (%d/%d): %s", test_count++, iter_count, \ opt_count, str); \ - fprintf(stdout," \n#####################################\n"); \ + fprintf(stdout, " \n#####################################\n"); \ } #define myheader_r(str) \ { \ - fprintf(stdout,"\n\n#####################################\n"); \ - fprintf(stdout,"%s", str); \ - fprintf(stdout," \n#####################################\n"); \ + fprintf(stdout, "\n\n#####################################\n"); \ + fprintf(stdout, "%s", str); \ + fprintf(stdout, " \n#####################################\n"); \ } static void print_error(const char *msg); @@ -93,17 +87,17 @@ if (r) \ assert(r != 0); \ } -#define check_execute(stmt,r) \ +#define check_execute(stmt, r) \ { \ if (r) \ - mysterror(stmt,NULL); \ + mysterror(stmt, NULL); \ assert(r == 0);\ } -#define check_execute_r(stmt,r) \ +#define check_execute_r(stmt, r) \ { \ if (r) \ - mysterror(stmt,NULL); \ + mysterror(stmt, NULL); \ assert(r != 0);\ } @@ -119,46 +113,50 @@ assert(stmt != 0); \ if (stmt == 0) \ myerror(NULL);\ assert(stmt == 0);\ -} +} #define mytest(x) if (!x) {myerror(NULL);assert(TRUE);} #define mytest_r(x) if (x) {myerror(NULL);assert(TRUE);} -/******************************************************** -* print the error message * -*********************************************************/ + +/* Print the error message */ + static void print_error(const char *msg) -{ +{ if (mysql && mysql_errno(mysql)) { if (mysql->server_version) - fprintf(stdout,"\n [MySQL-%s]",mysql->server_version); + fprintf(stdout, "\n [MySQL-%s]", mysql->server_version); else - fprintf(stdout,"\n [MySQL]"); - fprintf(stdout,"[%d] %s\n",mysql_errno(mysql),mysql_error(mysql)); + fprintf(stdout, "\n [MySQL]"); + fprintf(stdout, "[%d] %s\n", mysql_errno(mysql), mysql_error(mysql)); } else if (msg) fprintf(stderr, " [MySQL] %s\n", msg); } + static void print_st_error(MYSQL_STMT *stmt, const char *msg) -{ +{ if (stmt && mysql_stmt_errno(stmt)) { if (stmt->mysql && stmt->mysql->server_version) - fprintf(stdout,"\n [MySQL-%s]",stmt->mysql->server_version); + fprintf(stdout, "\n [MySQL-%s]", stmt->mysql->server_version); else - fprintf(stdout,"\n [MySQL]"); + fprintf(stdout, "\n [MySQL]"); - fprintf(stdout,"[%d] %s\n",mysql_stmt_errno(stmt), + fprintf(stdout, "[%d] %s\n", mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); } - else if (msg) fprintf(stderr, " [MySQL] %s\n", msg); + else if (msg) + fprintf(stderr, " [MySQL] %s\n", msg); } + /* This is to be what mysql_query() is for mysql_real_query(), for - mysql_prepare(): a variant without the 'length' parameter. + mysql_simple_prepare(): a variant without the 'length' parameter. */ + MYSQL_STMT *STDCALL mysql_simple_prepare(MYSQL *mysql, const char *query) { @@ -172,196 +170,197 @@ mysql_simple_prepare(MYSQL *mysql, const char *query) } -/******************************************************** -* connect to the server * -*********************************************************/ +/* Connect to the server */ + static void client_connect() { int rc; - myheader_r("client_connect"); + myheader_r("client_connect"); fprintf(stdout, "\n Establishing a connection to '%s' ...", opt_host); - - if (!(mysql = mysql_init(NULL))) - { + + if (!(mysql= mysql_init(NULL))) + { myerror("mysql_init() failed"); exit(0); } - - if (!(mysql_real_connect(mysql,opt_host,opt_user, + + if (!(mysql_real_connect(mysql, opt_host, opt_user, opt_password, opt_db ? opt_db:"test", opt_port, opt_unix_socket, 0))) { - myerror("connection failed"); + myerror("connection failed"); mysql_close(mysql); - fprintf(stdout,"\n Check the connection options using --help or -?\n"); + fprintf(stdout, "\n Check the connection options using --help or -?\n"); exit(0); - } - - fprintf(stdout," OK"); + } + + fprintf(stdout, " OK"); /* set AUTOCOMMIT to ON*/ mysql_autocommit(mysql, TRUE); - + fprintf(stdout, "\n Creating a test database '%s' ...", current_db); - strxmov(query,"CREATE DATABASE IF NOT EXISTS ", current_db, NullS); - - rc = mysql_query(mysql, query); + strxmov(query, "CREATE DATABASE IF NOT EXISTS ", current_db, NullS); + + rc= mysql_query(mysql, query); myquery(rc); - - strxmov(query,"USE ", current_db, NullS); - rc = mysql_query(mysql, query); + + strxmov(query, "USE ", current_db, NullS); + rc= mysql_query(mysql, query); myquery(rc); - - fprintf(stdout," OK"); + + fprintf(stdout, " OK"); } -/******************************************************** -* close the connection * -*********************************************************/ + +/* Close the connection */ + static void client_disconnect() -{ - myheader_r("client_disconnect"); +{ + myheader_r("client_disconnect"); if (mysql) { fprintf(stdout, "\n droping the test database '%s' ...", current_db); - strxmov(query,"DROP DATABASE IF EXISTS ", current_db, NullS); - + strxmov(query, "DROP DATABASE IF EXISTS ", current_db, NullS); + mysql_query(mysql, query); fprintf(stdout, " OK"); - + fprintf(stdout, "\n closing the connection ..."); mysql_close(mysql); fprintf(stdout, " OK\n"); } } -/******************************************************** -* query processing * -*********************************************************/ + +/* Query processing */ + static void client_query() { int rc; myheader("client_query"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS myclient_test"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS myclient_test"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE myclient_test(id int primary key auto_increment,\ - name varchar(20))"); + rc= mysql_query(mysql, "CREATE TABLE myclient_test(" + "id int primary key auto_increment, " + "name varchar(20))"); myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE myclient_test(id int, name varchar(20))"); + + rc= mysql_query(mysql, "CREATE TABLE myclient_test(id int, name varchar(20))"); myquery_r(rc); - - rc = mysql_query(mysql,"INSERT INTO myclient_test(name) VALUES('mysql')"); - myquery(rc); - - rc = mysql_query(mysql,"INSERT INTO myclient_test(name) VALUES('monty')"); + + rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('mysql')"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO myclient_test(name) VALUES('venu')"); + rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('monty')"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO myclient_test(name) VALUES('deleted')"); + rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('venu')"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO myclient_test(name) VALUES('deleted')"); + rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('deleted')"); myquery(rc); - rc = mysql_query(mysql,"UPDATE myclient_test SET name='updated' WHERE name='deleted'"); + rc= mysql_query(mysql, "INSERT INTO myclient_test(name) VALUES('deleted')"); myquery(rc); - rc = mysql_query(mysql,"UPDATE myclient_test SET id=3 WHERE name='updated'"); + rc= mysql_query(mysql, "UPDATE myclient_test SET name= 'updated' " + "WHERE name= 'deleted'"); + myquery(rc); + + rc= mysql_query(mysql, "UPDATE myclient_test SET id= 3 WHERE name= 'updated'"); myquery_r(rc); } -/******************************************************** -* print dashes * -*********************************************************/ + +/* Print dashes */ + static void my_print_dashes(MYSQL_RES *result) { MYSQL_FIELD *field; - unsigned int i,j; + unsigned int i, j; - mysql_field_seek(result,0); - fputc('\t',stdout); + mysql_field_seek(result, 0); + fputc('\t', stdout); fputc('+', stdout); - for(i=0; i< mysql_num_fields(result); i++) + for(i= 0; i< mysql_num_fields(result); i++) { - field = mysql_fetch_field(result); - for(j=0; j < field->max_length+2; j++) - fputc('-',stdout); - fputc('+',stdout); + field= mysql_fetch_field(result); + for(j= 0; j < field->max_length+2; j++) + fputc('-', stdout); + fputc('+', stdout); } - fputc('\n',stdout); + fputc('\n', stdout); } -/******************************************************** -* print resultset metadata information * -*********************************************************/ + +/* Print resultset metadata information */ + static void my_print_result_metadata(MYSQL_RES *result) { MYSQL_FIELD *field; - unsigned int i,j; + unsigned int i, j; unsigned int field_count; - mysql_field_seek(result,0); + mysql_field_seek(result, 0); fputc('\n', stdout); fputc('\n', stdout); - field_count = mysql_num_fields(result); - for(i=0; i< field_count; i++) + field_count= mysql_num_fields(result); + for(i= 0; i< field_count; i++) { - field = mysql_fetch_field(result); - j = strlen(field->name); + field= mysql_fetch_field(result); + j= strlen(field->name); if (j < field->max_length) - j = field->max_length; + j= field->max_length; if (j < 4 && !IS_NOT_NULL(field->flags)) - j = 4; - field->max_length = j; + j= 4; + field->max_length= j; } my_print_dashes(result); - fputc('\t',stdout); + fputc('\t', stdout); fputc('|', stdout); - mysql_field_seek(result,0); - for(i=0; i< field_count; i++) + mysql_field_seek(result, 0); + for(i= 0; i< field_count; i++) { - field = mysql_fetch_field(result); - fprintf(stdout, " %-*s |",(int) field->max_length, field->name); + field= mysql_fetch_field(result); + fprintf(stdout, " %-*s |", (int) field->max_length, field->name); } fputc('\n', stdout); my_print_dashes(result); } -/******************************************************** -* process the result set * -*********************************************************/ + +/* Process the result set */ + int my_process_result_set(MYSQL_RES *result) { MYSQL_ROW row; MYSQL_FIELD *field; unsigned int i; - unsigned int row_count=0; - + unsigned int row_count= 0; + if (!result) return 0; my_print_result_metadata(result); - while ((row = mysql_fetch_row(result)) != NULL) + while ((row= mysql_fetch_row(result)) != NULL) { - mysql_field_seek(result,0); - fputc('\t',stdout); - fputc('|',stdout); + mysql_field_seek(result, 0); + fputc('\t', stdout); + fputc('|', stdout); - for(i=0; i< mysql_num_fields(result); i++) + for(i= 0; i< mysql_num_fields(result); i++) { - field = mysql_fetch_field(result); + field= mysql_fetch_field(result); if (row[i] == NULL) fprintf(stdout, " %-*s |", (int) field->max_length, "NULL"); else if (IS_NUM(field->type)) @@ -369,38 +368,39 @@ int my_process_result_set(MYSQL_RES *result) else fprintf(stdout, " %-*s |", (int) field->max_length, row[i]); } - fputc('\t',stdout); - fputc('\n',stdout); + fputc('\t', stdout); + fputc('\n', stdout); row_count++; } - if (row_count) + if (row_count) my_print_dashes(result); if (mysql_errno(mysql) != 0) fprintf(stderr, "\n\tmysql_fetch_row() failed\n"); else - fprintf(stdout,"\n\t%d %s returned\n", row_count, + fprintf(stdout, "\n\t%d %s returned\n", row_count, row_count == 1 ? "row" : "rows"); return row_count; } + int my_process_result(MYSQL *mysql) { MYSQL_RES *result; int row_count; - if (!(result = mysql_store_result(mysql))) + if (!(result= mysql_store_result(mysql))) return 0; - + row_count= my_process_result_set(result); - + mysql_free_result(result); return row_count; } -/******************************************************** -* process the stmt result set * -*********************************************************/ + +/* Process the statement result set */ + #define MAX_RES_FIELDS 50 #define MAX_FIELD_DATA_SIZE 255 @@ -416,15 +416,20 @@ uint my_process_stmt_result(MYSQL_STMT *stmt) my_bool is_null[MAX_RES_FIELDS]; int rc, i; - if (!(result= mysql_get_metadata(stmt))) /* No meta info */ + if (!(result= mysql_stmt_result_metadata(stmt))) /* No meta info */ { - while (!mysql_fetch(stmt)) + while (!mysql_stmt_fetch(stmt)) row_count++; return row_count; } - + field_count= min(mysql_num_fields(result), MAX_RES_FIELDS); - for(i=0; i < field_count; i++) + + bzero((char*) buffer, sizeof(buffer)); + bzero((char*) length, sizeof(length)); + bzero((char*) is_null, sizeof(is_null)); + + for(i= 0; i < field_count; i++) { buffer[i].buffer_type= MYSQL_TYPE_STRING; buffer[i].buffer_length= MAX_FIELD_DATA_SIZE; @@ -434,27 +439,27 @@ uint my_process_stmt_result(MYSQL_STMT *stmt) } my_print_result_metadata(result); - rc= mysql_bind_result(stmt,buffer); - check_execute(stmt,rc); + rc= mysql_stmt_bind_result(stmt, buffer); + check_execute(stmt, rc); rc= mysql_stmt_store_result(stmt); - check_execute(stmt,rc); + check_execute(stmt, rc); - mysql_field_seek(result, 0); - while (mysql_fetch(stmt) == 0) - { - fputc('\t',stdout); - fputc('|',stdout); - - mysql_field_seek(result,0); - for (i=0; i < field_count; i++) + mysql_field_seek(result, 0); + while (mysql_stmt_fetch(stmt) == 0) + { + fputc('\t', stdout); + fputc('|', stdout); + + mysql_field_seek(result, 0); + for (i= 0; i < field_count; i++) { - field = mysql_fetch_field(result); + field= mysql_fetch_field(result); if (is_null[i]) fprintf(stdout, " %-*s |", (int) field->max_length, "NULL"); else if (length[i] == 0) { - data[i][0]='\0'; /* unmodified buffer */ + data[i][0]= '\0'; /* unmodified buffer */ fprintf(stdout, " %*s |", (int) field->max_length, data[i]); } else if (IS_NUM(field->type)) @@ -462,179 +467,183 @@ uint my_process_stmt_result(MYSQL_STMT *stmt) else fprintf(stdout, " %-*s |", (int) field->max_length, data[i]); } - fputc('\t',stdout); - fputc('\n',stdout); + fputc('\t', stdout); + fputc('\n', stdout); row_count++; } if (row_count) my_print_dashes(result); - fprintf(stdout,"\n\t%d %s returned\n", row_count, + fprintf(stdout, "\n\t%d %s returned\n", row_count, row_count == 1 ? "row" : "rows"); mysql_free_result(result); return row_count; } -/******************************************************** -* process the stmt result set * -*********************************************************/ + +/* Prepare statement, execute, and process result set for given query */ + uint my_stmt_result(const char *buff) { MYSQL_STMT *stmt; uint row_count; int rc; - fprintf(stdout,"\n\n %s", buff); - stmt= mysql_simple_prepare(mysql,buff); + fprintf(stdout, "\n\n %s", buff); + stmt= mysql_simple_prepare(mysql, buff); check_stmt(stmt); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); row_count= my_process_stmt_result(stmt); mysql_stmt_close(stmt); - + return row_count; } -/* - Utility function to verify a particular column data -*/ -static void verify_col_data(const char *table, const char *col, + +/* Utility function to verify a particular column data */ + +static void verify_col_data(const char *table, const char *col, const char *exp_data) { MYSQL_RES *result; MYSQL_ROW row; int rc, field= 1; - + if (table && col) { - strxmov(query,"SELECT ",col," FROM ",table," LIMIT 1", NullS); - fprintf(stdout,"\n %s", query); - rc = mysql_query(mysql, query); + strxmov(query, "SELECT ", col, " FROM ", table, " LIMIT 1", NullS); + fprintf(stdout, "\n %s", query); + rc= mysql_query(mysql, query); myquery(rc); field= 0; } - result = mysql_use_result(mysql); + result= mysql_use_result(mysql); mytest(result); if (!(row= mysql_fetch_row(result)) || !row[field]) { - fprintf(stdout,"\n *** ERROR: FAILED TO GET THE RESULT ***"); + fprintf(stdout, "\n *** ERROR: FAILED TO GET THE RESULT ***"); exit(1); } - if (strcmp(row[field],exp_data)) + if (strcmp(row[field], exp_data)) { - fprintf(stdout,"\n obtained: `%s` (expected: `%s`)", - row[field], exp_data); + fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", + row[field], exp_data); assert(0); } mysql_free_result(result); } -/* - Utility function to verify the field members -*/ -static void verify_prepare_field(MYSQL_RES *result, - unsigned int no,const char *name, const char *org_name, - enum enum_field_types type, const char *table, - const char *org_table, const char *db, +/* Utility function to verify the field members */ + +static void verify_prepare_field(MYSQL_RES *result, + unsigned int no, const char *name, const char *org_name, + enum enum_field_types type, const char *table, + const char *org_table, const char *db, unsigned long length, const char *def) { MYSQL_FIELD *field; - if (!(field= mysql_fetch_field_direct(result,no))) + if (!(field= mysql_fetch_field_direct(result, no))) { - fprintf(stdout,"\n *** ERROR: FAILED TO GET THE RESULT ***"); + fprintf(stdout, "\n *** ERROR: FAILED TO GET THE RESULT ***"); exit(1); } - fprintf(stdout,"\n field[%d]:", no); - fprintf(stdout,"\n name :`%s`\t(expected: `%s`)", field->name, name); - fprintf(stdout,"\n org_name :`%s`\t(expected: `%s`)", field->org_name, org_name); - fprintf(stdout,"\n type :`%d`\t(expected: `%d`)", field->type, type); - fprintf(stdout,"\n table :`%s`\t(expected: `%s`)", field->table, table); - fprintf(stdout,"\n org_table:`%s`\t(expected: `%s`)", field->org_table, org_table); - fprintf(stdout,"\n database :`%s`\t(expected: `%s`)", field->db, db); - fprintf(stdout,"\n length :`%ld`\t(expected: `%ld`)", field->length, length); - fprintf(stdout,"\n maxlength:`%ld`", field->max_length); - fprintf(stdout,"\n charsetnr:`%d`", field->charsetnr); - fprintf(stdout,"\n default :`%s`\t(expected: `%s`)", field->def ? field->def : "(null)", def ? def: "(null)"); - fprintf(stdout,"\n"); - assert(strcmp(field->name,name) == 0); - assert(strcmp(field->org_name,org_name) == 0); + fprintf(stdout, "\n field[%d]:", no); + fprintf(stdout, "\n name :`%s`\t(expected: `%s`)", field->name, name); + fprintf(stdout, "\n org_name :`%s`\t(expected: `%s`)", + field->org_name, org_name); + fprintf(stdout, "\n type :`%d`\t(expected: `%d`)", field->type, type); + fprintf(stdout, "\n table :`%s`\t(expected: `%s`)", + field->table, table); + fprintf(stdout, "\n org_table:`%s`\t(expected: `%s`)", + field->org_table, org_table); + fprintf(stdout, "\n database :`%s`\t(expected: `%s`)", field->db, db); + fprintf(stdout, "\n length :`%ld`\t(expected: `%ld`)", + field->length, length); + fprintf(stdout, "\n maxlength:`%ld`", field->max_length); + fprintf(stdout, "\n charsetnr:`%d`", field->charsetnr); + fprintf(stdout, "\n default :`%s`\t(expected: `%s`)", + field->def ? field->def : "(null)", def ? def: "(null)"); + fprintf(stdout, "\n"); + assert(strcmp(field->name, name) == 0); + assert(strcmp(field->org_name, org_name) == 0); assert(field->type == type); - assert(strcmp(field->table,table) == 0); - assert(strcmp(field->org_table,org_table) == 0); - assert(strcmp(field->db,db) == 0); + assert(strcmp(field->table, table) == 0); + assert(strcmp(field->org_table, org_table) == 0); + assert(strcmp(field->db, db) == 0); assert(field->length == length); if (def) - assert(strcmp(field->def,def) == 0); + assert(strcmp(field->def, def) == 0); } -/* - Utility function to verify the parameter count -*/ + +/* Utility function to verify the parameter count */ + static void verify_param_count(MYSQL_STMT *stmt, long exp_count) { - long param_count= mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in stmt: `%ld` (expected: `%ld`)", + long param_count= mysql_stmt_param_count(stmt); + fprintf(stdout, "\n total parameters in stmt: `%ld` (expected: `%ld`)", param_count, exp_count); assert(param_count == exp_count); } -/* - Utility function to verify the total affected rows -*/ + +/* Utility function to verify the total affected rows */ + static void verify_st_affected_rows(MYSQL_STMT *stmt, ulonglong exp_count) { ulonglong affected_rows= mysql_stmt_affected_rows(stmt); - fprintf(stdout,"\n total affected rows: `%lld` (expected: `%lld`)", + fprintf(stdout, "\n total affected rows: `%lld` (expected: `%lld`)", affected_rows, exp_count); assert(affected_rows == exp_count); } -/* - Utility function to verify the total affected rows -*/ + +/* Utility function to verify the total affected rows */ + static void verify_affected_rows(ulonglong exp_count) { ulonglong affected_rows= mysql_affected_rows(mysql); - fprintf(stdout,"\n total affected rows: `%lld` (expected: `%lld`)", + fprintf(stdout, "\n total affected rows: `%lld` (expected: `%lld`)", affected_rows, exp_count); assert(affected_rows == exp_count); } -/* - Utility function to verify the total fields count -*/ + +/* Utility function to verify the total fields count */ + static void verify_field_count(MYSQL_RES *result, uint exp_count) { uint field_count= mysql_num_fields(result); - fprintf(stdout,"\n total fields in the result set: `%d` (expected: `%d`)", + fprintf(stdout, "\n total fields in the result set: `%d` (expected: `%d`)", field_count, exp_count); assert(field_count == exp_count); } -/* - Utility function to execute a query using prepare-execute -*/ + +/* Utility function to execute a query using prepare-execute */ + static void execute_prepare_query(const char *query, ulonglong exp_count) { MYSQL_STMT *stmt; ulonglong affected_rows; int rc; - stmt= mysql_simple_prepare(mysql,query); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - rc = mysql_execute(stmt); - myquery(rc); + rc= mysql_stmt_execute(stmt); + myquery(rc); affected_rows= mysql_stmt_affected_rows(stmt); - fprintf(stdout,"\n total affected rows: `%lld` (expected: `%lld`)", + fprintf(stdout, "\n total affected rows: `%lld` (expected: `%lld`)", affected_rows, exp_count); assert(affected_rows == exp_count); @@ -642,9 +651,8 @@ static void execute_prepare_query(const char *query, ulonglong exp_count) } -/******************************************************** -* store result processing * -*********************************************************/ +/* Store result processing */ + static void client_store_result() { MYSQL_RES *result; @@ -652,63 +660,63 @@ static void client_store_result() myheader("client_store_result"); - rc = mysql_query(mysql, "SELECT * FROM myclient_test"); + rc= mysql_query(mysql, "SELECT * FROM myclient_test"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); my_process_result_set(result); mysql_free_result(result); } -/******************************************************** -* fetch the results -*********************************************************/ + +/* Fetch the results */ + static void client_use_result() { MYSQL_RES *result; int rc; myheader("client_use_result"); - rc = mysql_query(mysql, "SELECT * FROM myclient_test"); + rc= mysql_query(mysql, "SELECT * FROM myclient_test"); myquery(rc); /* get the result */ - result = mysql_use_result(mysql); + result= mysql_use_result(mysql); mytest(result); my_process_result_set(result); mysql_free_result(result); } -/* - Separate thread query to test some cases -*/ + +/* Separate thread query to test some cases */ + static my_bool thread_query(char *query) { MYSQL *l_mysql; my_bool error; error= 0; - fprintf(stdout,"\n in thread_query(%s)", query); - if (!(l_mysql = mysql_init(NULL))) - { + fprintf(stdout, "\n in thread_query(%s)", query); + if (!(l_mysql= mysql_init(NULL))) + { myerror("mysql_init() failed"); return 1; } - if (!(mysql_real_connect(l_mysql,opt_host,opt_user, - opt_password, current_db, opt_port, - opt_unix_socket, 0))) + if (!(mysql_real_connect(l_mysql, opt_host, opt_user, + opt_password, current_db, opt_port, + opt_unix_socket, 0))) { - myerror("connection failed"); + myerror("connection failed"); error= 1; goto end; - } - if (mysql_query(l_mysql,(char *)query)) + } + if (mysql_query(l_mysql, (char *)query)) { - fprintf(stderr,"Query failed (%s)\n",mysql_error(l_mysql)); + fprintf(stderr, "Query failed (%s)\n", mysql_error(l_mysql)); error= 1; goto end; } @@ -719,9 +727,8 @@ end: } -/******************************************************** -* query processing * -*********************************************************/ +/* Query processing */ + static void test_debug_example() { int rc; @@ -729,35 +736,38 @@ static void test_debug_example() myheader("test_debug_example"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_debug_example"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_debug_example"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_debug_example(id int primary key auto_increment,\ - name varchar(20),xxx int)"); + rc= mysql_query(mysql, "CREATE TABLE test_debug_example(" + "id INT PRIMARY KEY AUTO_INCREMENT, " + "name VARCHAR(20), xxx INT)"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_debug_example(name) VALUES('mysql')"); + rc= mysql_query(mysql, "INSERT INTO test_debug_example (name) " + "VALUES ('mysql')"); myquery(rc); - rc = mysql_query(mysql,"UPDATE test_debug_example SET name='updated' WHERE name='deleted'"); + rc= mysql_query(mysql, "UPDATE test_debug_example SET name='updated' " + "WHERE name='deleted'"); myquery(rc); - rc = mysql_query(mysql,"SELECT * FROM test_debug_example where name='mysql'"); + rc= mysql_query(mysql, "SELECT * FROM test_debug_example where name='mysql'"); myquery(rc); - result = mysql_use_result(mysql); + result= mysql_use_result(mysql); mytest(result); my_process_result_set(result); mysql_free_result(result); - rc = mysql_query(mysql,"DROP TABLE test_debug_example"); + rc= mysql_query(mysql, "DROP TABLE test_debug_example"); myquery(rc); } -/******************************************************** -* to test autocommit feature * -*********************************************************/ + +/* Test autocommit feature for BDB tables */ + static void test_tran_bdb() { MYSQL_RES *result; @@ -767,76 +777,71 @@ static void test_tran_bdb() myheader("test_tran_bdb"); /* set AUTOCOMMIT to OFF */ - rc = mysql_autocommit(mysql, FALSE); + rc= mysql_autocommit(mysql, FALSE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS my_demo_transaction"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS my_demo_transaction"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - /* create the table 'mytran_demo' of type BDB' or 'InnoDB' */ - rc = mysql_query(mysql,"CREATE TABLE my_demo_transaction(col1 int ,col2 varchar(30)) TYPE = BDB"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE my_demo_transaction( " + "col1 int , col2 varchar(30)) TYPE= BDB"); myquery(rc); /* insert a row and commit the transaction */ - rc = mysql_query(mysql,"INSERT INTO my_demo_transaction VALUES(10,'venu')"); + rc= mysql_query(mysql, "INSERT INTO my_demo_transaction VALUES(10, 'venu')"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* now insert the second row, and rollback the transaction */ - rc = mysql_query(mysql,"INSERT INTO my_demo_transaction VALUES(20,'mysql')"); + rc= mysql_query(mysql, "INSERT INTO my_demo_transaction VALUES(20, 'mysql')"); myquery(rc); - rc = mysql_rollback(mysql); + rc= mysql_rollback(mysql); myquery(rc); /* delete first row, and rollback it */ - rc = mysql_query(mysql,"DELETE FROM my_demo_transaction WHERE col1 = 10"); + rc= mysql_query(mysql, "DELETE FROM my_demo_transaction WHERE col1= 10"); myquery(rc); - rc = mysql_rollback(mysql); + rc= mysql_rollback(mysql); myquery(rc); /* test the results now, only one row should exists */ - rc = mysql_query(mysql,"SELECT * FROM my_demo_transaction"); + rc= mysql_query(mysql, "SELECT * FROM my_demo_transaction"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); my_process_result_set(result); mysql_free_result(result); /* test the results now, only one row should exists */ - rc = mysql_query(mysql,"SELECT * FROM my_demo_transaction"); + rc= mysql_query(mysql, "SELECT * FROM my_demo_transaction"); myquery(rc); /* get the result */ - result = mysql_use_result(mysql); + result= mysql_use_result(mysql); mytest(result); - row = mysql_fetch_row(result); + row= mysql_fetch_row(result); mytest(row); - row = mysql_fetch_row(result); + row= mysql_fetch_row(result); mytest_r(row); mysql_free_result(result); - mysql_autocommit(mysql,TRUE); + mysql_autocommit(mysql, TRUE); } -/******************************************************** -* to test autocommit feature * -*********************************************************/ + +/* Test autocommit feature for InnoDB tables */ + static void test_tran_innodb() { MYSQL_RES *result; @@ -846,76 +851,69 @@ static void test_tran_innodb() myheader("test_tran_innodb"); /* set AUTOCOMMIT to OFF */ - rc = mysql_autocommit(mysql, FALSE); + rc= mysql_autocommit(mysql, FALSE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS my_demo_transaction"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS my_demo_transaction"); myquery(rc); /* create the table 'mytran_demo' of type BDB' or 'InnoDB' */ - rc = mysql_query(mysql,"CREATE TABLE my_demo_transaction(col1 int ,col2 varchar(30)) TYPE = InnoDB"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE my_demo_transaction(col1 int, " + "col2 varchar(30)) TYPE= InnoDB"); myquery(rc); /* insert a row and commit the transaction */ - rc = mysql_query(mysql,"INSERT INTO my_demo_transaction VALUES(10,'venu')"); + rc= mysql_query(mysql, "INSERT INTO my_demo_transaction VALUES(10, 'venu')"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* now insert the second row, and rollback the transaction */ - rc = mysql_query(mysql,"INSERT INTO my_demo_transaction VALUES(20,'mysql')"); + rc= mysql_query(mysql, "INSERT INTO my_demo_transaction VALUES(20, 'mysql')"); myquery(rc); - rc = mysql_rollback(mysql); + rc= mysql_rollback(mysql); myquery(rc); /* delete first row, and rollback it */ - rc = mysql_query(mysql,"DELETE FROM my_demo_transaction WHERE col1 = 10"); + rc= mysql_query(mysql, "DELETE FROM my_demo_transaction WHERE col1= 10"); myquery(rc); - rc = mysql_rollback(mysql); + rc= mysql_rollback(mysql); myquery(rc); /* test the results now, only one row should exists */ - rc = mysql_query(mysql,"SELECT * FROM my_demo_transaction"); + rc= mysql_query(mysql, "SELECT * FROM my_demo_transaction"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); my_process_result_set(result); mysql_free_result(result); /* test the results now, only one row should exists */ - rc = mysql_query(mysql,"SELECT * FROM my_demo_transaction"); + rc= mysql_query(mysql, "SELECT * FROM my_demo_transaction"); myquery(rc); /* get the result */ - result = mysql_use_result(mysql); + result= mysql_use_result(mysql); mytest(result); - row = mysql_fetch_row(result); + row= mysql_fetch_row(result); mytest(row); - row = mysql_fetch_row(result); + row= mysql_fetch_row(result); mytest_r(row); mysql_free_result(result); - mysql_autocommit(mysql,TRUE); + mysql_autocommit(mysql, TRUE); } -/******************************************************** - To test simple prepares of all DML statements -*********************************************************/ +/* Test simple prepares of all DML statements */ static void test_prepare_simple() { @@ -924,69 +922,66 @@ static void test_prepare_simple() myheader("test_prepare_simple"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prepare_simple"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prepare_simple"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_prepare_simple(id int, name varchar(50))"); + rc= mysql_query(mysql, "CREATE TABLE test_prepare_simple(" + "id int, name varchar(50))"); myquery(rc); /* insert */ - strmov(query,"INSERT INTO test_prepare_simple VALUES(?,?)"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO test_prepare_simple VALUES(?, ?)"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); mysql_stmt_close(stmt); /* update */ - strmov(query,"UPDATE test_prepare_simple SET id=? WHERE id=? AND name= ?"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "UPDATE test_prepare_simple SET id=? WHERE id=? AND name= ?"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,3); + verify_param_count(stmt, 3); mysql_stmt_close(stmt); /* delete */ - strmov(query,"DELETE FROM test_prepare_simple WHERE id=10"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "DELETE FROM test_prepare_simple WHERE id=10"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,0); + verify_param_count(stmt, 0); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); mysql_stmt_close(stmt); /* delete */ - strmov(query,"DELETE FROM test_prepare_simple WHERE id=?"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "DELETE FROM test_prepare_simple WHERE id=?"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,1); + verify_param_count(stmt, 1); mysql_stmt_close(stmt); /* select */ - strmov(query,"SELECT * FROM test_prepare_simple WHERE id=? AND name= ?"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "SELECT * FROM test_prepare_simple WHERE id=? AND name= ?"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); mysql_stmt_close(stmt); /* now fetch the results ..*/ - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); } -/******************************************************** -* to test simple prepare field results * -*********************************************************/ +/* Test simple prepare field results */ + static void test_prepare_field_result() { MYSQL_STMT *stmt; @@ -995,41 +990,38 @@ static void test_prepare_field_result() myheader("test_prepare_field_result"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prepare_field_result"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prepare_field_result"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_prepare_field_result(int_c int, " + "var_c varchar(50), ts_c timestamp(14), " + "char_c char(3), date_c date, extra tinyint)"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_prepare_field_result(int_c int, \ - var_c varchar(50), ts_c timestamp(14),\ - char_c char(3), date_c date,extra tinyint)"); - myquery(rc); - /* insert */ - strmov(query,"SELECT int_c,var_c,date_c as date,ts_c,char_c FROM \ - test_prepare_field_result as t1 WHERE int_c=?"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "SELECT int_c, var_c, date_c as date, ts_c, char_c FROM " + " test_prepare_field_result as t1 WHERE int_c=?"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,1); + verify_param_count(stmt, 1); - result = mysql_get_metadata(stmt); + result= mysql_stmt_result_metadata(stmt); mytest(result); - + my_print_result_metadata(result); - fprintf(stdout,"\n\n field attributes:\n"); - verify_prepare_field(result,0,"int_c","int_c",MYSQL_TYPE_LONG, - "t1","test_prepare_field_result",current_db,11,0); - verify_prepare_field(result,1,"var_c","var_c",MYSQL_TYPE_VAR_STRING, - "t1","test_prepare_field_result",current_db,50,0); - verify_prepare_field(result,2,"date","date_c",MYSQL_TYPE_DATE, - "t1","test_prepare_field_result",current_db,10,0); - verify_prepare_field(result,3,"ts_c","ts_c",MYSQL_TYPE_TIMESTAMP, - "t1","test_prepare_field_result",current_db,19,0); - verify_prepare_field(result,4,"char_c","char_c",MYSQL_TYPE_STRING, - "t1","test_prepare_field_result",current_db,3,0); + fprintf(stdout, "\n\n field attributes:\n"); + verify_prepare_field(result, 0, "int_c", "int_c", MYSQL_TYPE_LONG, + "t1", "test_prepare_field_result", current_db, 11, 0); + verify_prepare_field(result, 1, "var_c", "var_c", MYSQL_TYPE_VAR_STRING, + "t1", "test_prepare_field_result", current_db, 50, 0); + verify_prepare_field(result, 2, "date", "date_c", MYSQL_TYPE_DATE, + "t1", "test_prepare_field_result", current_db, 10, 0); + verify_prepare_field(result, 3, "ts_c", "ts_c", MYSQL_TYPE_TIMESTAMP, + "t1", "test_prepare_field_result", current_db, 19, 0); + verify_prepare_field(result, 4, "char_c", "char_c", MYSQL_TYPE_STRING, + "t1", "test_prepare_field_result", current_db, 3, 0); verify_field_count(result, 5); mysql_free_result(result); @@ -1037,9 +1029,8 @@ static void test_prepare_field_result() } -/******************************************************** -* to test simple prepare field results * -*********************************************************/ +/* Test simple prepare field results */ + static void test_prepare_syntax() { MYSQL_STMT *stmt; @@ -1047,32 +1038,29 @@ static void test_prepare_syntax() myheader("test_prepare_syntax"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prepare_syntax"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prepare_syntax"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_prepare_syntax(" + "id int, name varchar(50), extra int)"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_prepare_syntax(id int, name varchar(50), extra int)"); - myquery(rc); - - strmov(query,"INSERT INTO test_prepare_syntax VALUES(?"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO test_prepare_syntax VALUES(?"); + stmt= mysql_simple_prepare(mysql, query); check_stmt_r(stmt); - strmov(query,"SELECT id,name FROM test_prepare_syntax WHERE id=? AND WHERE"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "SELECT id, name FROM test_prepare_syntax WHERE id=? AND WHERE"); + stmt= mysql_simple_prepare(mysql, query); check_stmt_r(stmt); /* now fetch the results ..*/ - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); } -/******************************************************** -* to test simple prepare * -*********************************************************/ +/* Test a simple prepare */ + static void test_prepare() { MYSQL_STMT *stmt; @@ -1090,49 +1078,48 @@ static void test_prepare() myheader("test_prepare"); - rc = mysql_autocommit(mysql, TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS my_prepare"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS my_prepare"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE my_prepare(col1 tinyint,\ - col2 varchar(15), col3 int,\ - col4 smallint, col5 bigint, \ - col6 float, col7 double )"); + rc= mysql_query(mysql, "CREATE TABLE my_prepare(col1 tinyint, " + "col2 varchar(15), col3 int, " + "col4 smallint, col5 bigint, " + "col6 float, col7 double )"); myquery(rc); /* insert by prepare */ - strxmov(query,"INSERT INTO my_prepare VALUES(?,?,?,?,?,?,?)",NullS); - stmt = mysql_simple_prepare(mysql, query); + strxmov(query, "INSERT INTO my_prepare VALUES(?, ?, ?, ?, ?, ?, ?)", NullS); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,7); + verify_param_count(stmt, 7); + + bzero((char*) bind, sizeof(bind)); /* tinyint */ - bind[0].buffer_type=FIELD_TYPE_TINY; + bind[0].buffer_type= MYSQL_TYPE_TINY; bind[0].buffer= (char *)&tiny_data; /* string */ - bind[1].buffer_type=FIELD_TYPE_STRING; + bind[1].buffer_type= MYSQL_TYPE_STRING; bind[1].buffer= (char *)str_data; - bind[1].buffer_length= 1000; /* Max string length */ + bind[1].buffer_length= 1000; /* Max string length */ /* integer */ - bind[2].buffer_type=FIELD_TYPE_LONG; + bind[2].buffer_type= MYSQL_TYPE_LONG; bind[2].buffer= (char *)&int_data; /* short */ - bind[3].buffer_type=FIELD_TYPE_SHORT; + bind[3].buffer_type= MYSQL_TYPE_SHORT; bind[3].buffer= (char *)&small_data; /* bigint */ - bind[4].buffer_type=FIELD_TYPE_LONGLONG; + bind[4].buffer_type= MYSQL_TYPE_LONGLONG; bind[4].buffer= (char *)&big_data; /* float */ - bind[5].buffer_type=FIELD_TYPE_FLOAT; + bind[5].buffer_type= MYSQL_TYPE_FLOAT; bind[5].buffer= (char *)&real_data; /* double */ - bind[6].buffer_type=FIELD_TYPE_DOUBLE; + bind[6].buffer_type= MYSQL_TYPE_DOUBLE; bind[6].buffer= (char *)&double_data; for (i= 0; i < (int) array_elements(bind); i++) @@ -1142,20 +1129,20 @@ static void test_prepare() is_null[i]= 0; } - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - int_data = 320; - small_data = 1867; - big_data = 1000; - real_data = 2; - double_data = 6578.001; + int_data= 320; + small_data= 1867; + big_data= 1000; + real_data= 2; + double_data= 6578.001; /* now, execute the prepared statement to insert 10 records.. */ - for (tiny_data=0; tiny_data < 100; tiny_data++) + for (tiny_data= 0; tiny_data < 100; tiny_data++) { - length[1]= my_sprintf(str_data,(str_data, "MySQL%d",int_data)); - rc = mysql_execute(stmt); + length[1]= my_sprintf(str_data, (str_data, "MySQL%d", int_data)); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); int_data += 25; small_data += 10; @@ -1167,45 +1154,45 @@ static void test_prepare() mysql_stmt_close(stmt); /* now fetch the results ..*/ - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* test the results now, only one row should exists */ assert(tiny_data == (char) my_stmt_result("SELECT * FROM my_prepare")); - - stmt = mysql_simple_prepare(mysql,"SELECT * FROM my_prepare"); + + stmt= mysql_simple_prepare(mysql, "SELECT * FROM my_prepare"); check_stmt(stmt); - rc = mysql_bind_result(stmt, bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); /* get the result */ - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - - o_int_data = 320; - o_small_data = 1867; - o_big_data = 1000; - o_real_data = 2; - o_double_data = 6578.001; + + o_int_data= 320; + o_small_data= 1867; + o_big_data= 1000; + o_real_data= 2; + o_double_data= 6578.001; /* now, execute the prepared statement to insert 10 records.. */ - for (o_tiny_data=0; o_tiny_data < 100; o_tiny_data++) + for (o_tiny_data= 0; o_tiny_data < 100; o_tiny_data++) { - len = my_sprintf(data, (data, "MySQL%d",o_int_data)); - - rc = mysql_fetch(stmt); + len= my_sprintf(data, (data, "MySQL%d", o_int_data)); + + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); fprintf(stdout, "\n"); - - fprintf(stdout, "\n\t tiny : %d (%lu)", tiny_data,length[0]); - fprintf(stdout, "\n\t short : %d (%lu)", small_data,length[3]); - fprintf(stdout, "\n\t int : %d (%lu)", int_data,length[2]); - fprintf(stdout, "\n\t big : %lld (%lu)", big_data,length[4]); - fprintf(stdout, "\n\t float : %f (%lu)", real_data,length[5]); - fprintf(stdout, "\n\t double : %f (%lu)", double_data,length[6]); + fprintf(stdout, "\n\t tiny : %d (%lu)", tiny_data, length[0]); + fprintf(stdout, "\n\t short : %d (%lu)", small_data, length[3]); + fprintf(stdout, "\n\t int : %d (%lu)", int_data, length[2]); + fprintf(stdout, "\n\t big : %lld (%lu)", big_data, length[4]); + + fprintf(stdout, "\n\t float : %f (%lu)", real_data, length[5]); + fprintf(stdout, "\n\t double : %f (%lu)", double_data, length[6]); fprintf(stdout, "\n\t str : %s (%lu)", str_data, length[1]); @@ -1215,22 +1202,22 @@ static void test_prepare() assert(int_data == o_int_data); assert(length[2] == 4); - + assert(small_data == o_small_data); assert(length[3] == 2); - + assert(big_data == o_big_data); assert(length[4] == 8); - + assert(real_data == o_real_data); assert(length[5] == 4); - + assert(double_data == o_double_data); assert(length[6] == 8); - - assert(strcmp(data,str_data) == 0); + + assert(strcmp(data, str_data) == 0); assert(length[1] == len); - + o_int_data += 25; o_small_data += 10; o_big_data += 100; @@ -1238,7 +1225,7 @@ static void test_prepare() o_double_data += 10.09; } - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); @@ -1246,9 +1233,8 @@ static void test_prepare() } -/******************************************************** -* to test double comparision * -*********************************************************/ +/* Test double comparision */ + static void test_double_compare() { MYSQL_STMT *stmt; @@ -1257,61 +1243,56 @@ static void test_double_compare() double double_data; MYSQL_RES *result; MYSQL_BIND bind[3]; - ulong length[3]; + ulong length[3]; myheader("test_double_compare"); - rc = mysql_autocommit(mysql, TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_double_compare"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_double_compare"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_double_compare(col1 tinyint, " + " col2 float, col3 double )"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_double_compare(col1 tinyint,\ - col2 float, col3 double )"); + rc= mysql_query(mysql, "INSERT INTO test_double_compare " + "VALUES (1, 10.2, 34.5)"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_double_compare VALUES(1,10.2,34.5)"); - myquery(rc); - - strmov(query, "UPDATE test_double_compare SET col1=100 WHERE col1 = ? AND col2 = ? AND COL3 = ?"); - stmt = mysql_simple_prepare(mysql,query); + strmov(query, "UPDATE test_double_compare SET col1=100 " + "WHERE col1 = ? AND col2 = ? AND COL3 = ?"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,3); + verify_param_count(stmt, 3); + + /* Always bzero bind array because there can be internal members */ + bzero((char*) bind, sizeof(bind)); /* tinyint */ - bind[0].buffer_type=FIELD_TYPE_TINY; - bind[0].buffer=(char *)&tiny_data; - bind[0].buffer_length= 0; - bind[0].length= 0; - bind[0].is_null= 0; /* Can never be null */ + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[0].buffer= (char *)&tiny_data; /* string->float */ - bind[1].buffer_type=FIELD_TYPE_STRING; + bind[1].buffer_type= MYSQL_TYPE_STRING; bind[1].buffer= (char *)&real_data; - bind[1].buffer_length=sizeof(real_data); - bind[1].is_null= 0; + bind[1].buffer_length= sizeof(real_data); bind[1].length= &length[1]; - length[1]= 10; + length[1]= 10; /* double */ - bind[2].buffer_type=FIELD_TYPE_DOUBLE; + bind[2].buffer_type= MYSQL_TYPE_DOUBLE; bind[2].buffer= (char *)&double_data; - bind[2].buffer_length= 0; - bind[2].length= 0; - bind[2].is_null= 0; - tiny_data = 1; - strmov(real_data,"10.2"); - double_data = 34.5; - rc = mysql_bind_param(stmt,bind); + tiny_data= 1; + strmov(real_data, "10.2"); + double_data= 34.5; + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); verify_affected_rows(0); @@ -1319,15 +1300,15 @@ static void test_double_compare() mysql_stmt_close(stmt); /* now fetch the results ..*/ - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* test the results now, only one row should exists */ - rc = mysql_query(mysql,"SELECT * FROM test_double_compare"); + rc= mysql_query(mysql, "SELECT * FROM test_double_compare"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert((int)tiny_data == my_process_result_set(result)); @@ -1335,9 +1316,8 @@ static void test_double_compare() } -/******************************************************** -* to test simple null * -*********************************************************/ +/* Test simple null */ + static void test_null() { MYSQL_STMT *stmt; @@ -1348,39 +1328,38 @@ static void test_null() myheader("test_null"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_null"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_null"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_null(col1 int,col2 varchar(50))"); + rc= mysql_query(mysql, "CREATE TABLE test_null(col1 int, col2 varchar(50))"); myquery(rc); /* insert by prepare, wrong column name */ - strmov(query,"INSERT INTO test_null(col3,col2) VALUES(?,?)"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO test_null(col3, col2) VALUES(?, ?)"); + stmt= mysql_simple_prepare(mysql, query); check_stmt_r(stmt); - strmov(query,"INSERT INTO test_null(col1,col2) VALUES(?,?)"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO test_null(col1, col2) VALUES(?, ?)"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); - bind[0].buffer_type=MYSQL_TYPE_LONG; + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); + + bind[0].buffer_type= MYSQL_TYPE_LONG; bind[0].is_null= &is_null[0]; - bind[0].length= 0; is_null[0]= 1; - bind[1]=bind[0]; + bind[1]= bind[0]; - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); /* now, execute the prepared statement to insert 10 records.. */ - for (nData=0; nData<10; nData++) + for (nData= 0; nData<10; nData++) { - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); } @@ -1389,19 +1368,19 @@ static void test_null() is_null[0]= 0; /* reset */ bind[1]= bind[0]; - rc = mysql_bind_param(stmt,bind); - check_execute(stmt,rc); - - for (nData=0; nData<10; nData++) + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); + + for (nData= 0; nData<10; nData++) { - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); } - + mysql_stmt_close(stmt); /* now fetch the results ..*/ - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); nData*= 2; @@ -1415,18 +1394,18 @@ static void test_null() bind[0].is_null= &is_null[0]; bind[1].is_null= &is_null[1]; - stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_null"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_null"); check_stmt(stmt); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - rc = mysql_bind_result(stmt,bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_result(stmt, bind); + check_execute(stmt, rc); rc= 0; is_null[0]= is_null[1]= 0; - while (mysql_fetch(stmt) != MYSQL_NO_DATA) + while (mysql_stmt_fetch(stmt) != MYSQL_NO_DATA) { assert(is_null[0]); assert(is_null[1]); @@ -1437,24 +1416,24 @@ static void test_null() mysql_stmt_close(stmt); } -/********************************************************* -* Test for NULL as PS parameter (BUG#3367, BUG#3371) * -**********************************************************/ + +/* Test for NULL as PS parameter (BUG#3367, BUG#3371) */ + static void test_ps_null_param() { MYSQL_STMT *stmt; int rc; - + MYSQL_BIND in_bind; my_bool in_is_null; long int in_long; - + MYSQL_BIND out_bind; - ulong out_length; + ulong out_length; my_bool out_is_null; char out_str_data[20]; - const char *queries[]= {"select ?", "select ?+1", + const char *queries[]= {"select ?", "select ?+1", "select col1 from test_ps_nulls where col1 <=> ?", NULL }; @@ -1462,15 +1441,19 @@ static void test_ps_null_param() myheader("test_null_ps_param_in_result"); - rc= mysql_query(mysql,"DROP TABLE IF EXISTS test_ps_nulls"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_ps_nulls"); myquery(rc); - rc= mysql_query(mysql,"CREATE TABLE test_ps_nulls(col1 int)"); + rc= mysql_query(mysql, "CREATE TABLE test_ps_nulls(col1 int)"); myquery(rc); - rc= mysql_query(mysql,"INSERT INTO test_ps_nulls values (1),(null)"); + rc= mysql_query(mysql, "INSERT INTO test_ps_nulls values (1), (null)"); myquery(rc); + /* Always bzero all members of bind parameter */ + bzero((char*) &in_bind, sizeof(in_bind)); + bzero((char*) &out_bind, sizeof(out_bind)); + in_bind.buffer_type= MYSQL_TYPE_LONG; in_bind.is_null= &in_is_null; in_bind.length= 0; @@ -1478,102 +1461,98 @@ static void test_ps_null_param() in_is_null= 1; in_long= 1; - out_bind.buffer_type=FIELD_TYPE_STRING; + out_bind.buffer_type= MYSQL_TYPE_STRING; out_bind.is_null= &out_is_null; out_bind.length= &out_length; out_bind.buffer= out_str_data; - out_bind.buffer_length= array_elements(out_str_data); - + out_bind.buffer_length= array_elements(out_str_data); + /* Execute several queries, all returning NULL in result. */ for(cur_query= queries; *cur_query; cur_query++) { strmov(query, *cur_query); - stmt = mysql_simple_prepare(mysql, query); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,1); + verify_param_count(stmt, 1); - rc = mysql_bind_param(stmt,&in_bind); + rc= mysql_stmt_bind_param(stmt, &in_bind); check_execute(stmt, rc); - rc= mysql_bind_result(stmt,&out_bind); + rc= mysql_stmt_bind_result(stmt, &out_bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc= mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc != MYSQL_NO_DATA); assert(out_is_null); - rc= mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } } -/******************************************************** -* to test fetch null * -*********************************************************/ + +/* Test fetch null */ + static void test_fetch_null() { MYSQL_STMT *stmt; int rc; int i, nData; MYSQL_BIND bind[11]; - ulong length[11]; + ulong length[11]; my_bool is_null[11]; myheader("test_fetch_null"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_fetch_null"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_fetch_null"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_fetch_null(" + " col1 tinyint, col2 smallint, " + " col3 int, col4 bigint, " + " col5 float, col6 double, " + " col7 date, col8 time, " + " col9 varbinary(10), " + " col10 varchar(50), " + " col11 char(20))"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint, \ - col3 int, col4 bigint, \ - col5 float, col6 double, \ - col7 date, col8 time, \ - col9 varbinary(10), \ - col10 varchar(50),\ - col11 char(20))"); + rc= mysql_query(mysql, "INSERT INTO test_fetch_null (col11) " + "VALUES (1000), (88), (389789)"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"INSERT INTO test_fetch_null(col11) VALUES(1000),(88),(389789)"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* fetch */ for (i= 0; i < (int) array_elements(bind); i++) { - bind[i].buffer_type=FIELD_TYPE_LONG; + bind[i].buffer_type= MYSQL_TYPE_LONG; bind[i].is_null= &is_null[i]; bind[i].length= &length[i]; } - bind[i-1].buffer=(char *)&nData; /* Last column is not null */ + bind[i-1].buffer= (char *)&nData; /* Last column is not null */ strmov((char *)query , "SELECT * FROM test_fetch_null"); assert(3 == my_stmt_result(query)); - stmt = mysql_simple_prepare(mysql, query); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - rc = mysql_bind_result(stmt,bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); rc= 0; - while (mysql_fetch(stmt) != MYSQL_NO_DATA) + while (mysql_stmt_fetch(stmt) != MYSQL_NO_DATA) { rc++; - for (i=0; i < 10; i++) + for (i= 0; i < 10; i++) { - fprintf(stdout, "\n data[%d] : %s", i, + fprintf(stdout, "\n data[%d] : %s", i, is_null[i] ? "NULL" : "NOT NULL"); assert(is_null[i]); } @@ -1587,9 +1566,8 @@ static void test_fetch_null() } -/******************************************************** -* to test simple select * -*********************************************************/ +/* Test simple select */ + static void test_select_version() { MYSQL_STMT *stmt; @@ -1597,21 +1575,21 @@ static void test_select_version() myheader("test_select_version"); - stmt = mysql_simple_prepare(mysql, "SELECT @@version"); + stmt= mysql_simple_prepare(mysql, "SELECT @@version"); check_stmt(stmt); - verify_param_count(stmt,0); + verify_param_count(stmt, 0); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); my_process_stmt_result(stmt); mysql_stmt_close(stmt); } -/******************************************************** -* to test simple show * -*********************************************************/ + +/* Test simple show */ + static void test_select_show_table() { MYSQL_STMT *stmt; @@ -1619,14 +1597,14 @@ static void test_select_show_table() myheader("test_select_show_table"); - stmt = mysql_simple_prepare(mysql, "SHOW TABLES FROM mysql"); + stmt= mysql_simple_prepare(mysql, "SHOW TABLES FROM mysql"); check_stmt(stmt); - verify_param_count(stmt,0); + verify_param_count(stmt, 0); for (i= 1; i < 3; i++) { - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); } @@ -1635,46 +1613,39 @@ static void test_select_show_table() } -/******************************************************** -* to test simple select to debug * -*********************************************************/ +/* Test simple select to debug */ + static void test_select_direct() { int rc; MYSQL_RES *result; myheader("test_select_direct"); - - rc = mysql_autocommit(mysql,TRUE); + + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_select"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_select"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_select(id int, id1 tinyint, \ - id2 float, \ - id3 double, \ - name varchar(50))"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_select(id int, id1 tinyint, " + " id2 float, " + " id3 double, " + " name varchar(50))"); myquery(rc); /* insert a row and commit the transaction */ - rc = mysql_query(mysql,"INSERT INTO test_select VALUES(10,5,2.3,4.5,'venu')"); + rc= mysql_query(mysql, "INSERT INTO test_select VALUES(10, 5, 2.3, 4.5, 'venu')"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); - rc = mysql_query(mysql,"SELECT * FROM test_select"); + rc= mysql_query(mysql, "SELECT * FROM test_select"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); my_process_result_set(result); @@ -1682,148 +1653,124 @@ static void test_select_direct() } -/******************************************************** -* to test simple select with prepare * -*********************************************************/ +/* Test simple select with prepare */ + static void test_select_prepare() { int rc; MYSQL_STMT *stmt; myheader("test_select_prepare"); - - rc = mysql_autocommit(mysql,TRUE); + + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_select"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_select"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_select(id int, name varchar(50))"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_select(id int, name varchar(50))"); myquery(rc); /* insert a row and commit the transaction */ - rc = mysql_query(mysql,"INSERT INTO test_select VALUES(10,'venu')"); + rc= mysql_query(mysql, "INSERT INTO test_select VALUES(10, 'venu')"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); - stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_select"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_select"); check_stmt(stmt); - - rc = mysql_execute(stmt); - check_execute(stmt,rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); assert(1 == my_process_stmt_result(stmt)); mysql_stmt_close(stmt); - rc = mysql_query(mysql,"DROP TABLE test_select"); + rc= mysql_query(mysql, "DROP TABLE test_select"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_select(id tinyint, id1 int, \ - id2 float, id3 float, \ - name varchar(50))"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_select(id tinyint, id1 int, " + " id2 float, id3 float, " + " name varchar(50))"); myquery(rc); /* insert a row and commit the transaction */ - rc = mysql_query(mysql,"INSERT INTO test_select(id,id1,id2,name) VALUES(10,5,2.3,'venu')"); + rc= mysql_query(mysql, "INSERT INTO test_select(id, id1, id2, name) VALUES(10, 5, 2.3, 'venu')"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); - stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_select"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_select"); check_stmt(stmt); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); assert(1 == my_process_stmt_result(stmt)); mysql_stmt_close(stmt); } -/******************************************************** -* to test simple select * -*********************************************************/ +/* Test simple select */ + static void test_select() { MYSQL_STMT *stmt; int rc; char szData[25]; - int nData=1; + int nData= 1; MYSQL_BIND bind[2]; ulong length[2]; myheader("test_select"); - rc = mysql_autocommit(mysql,TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_select"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_select"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_select(id int,name varchar(50))"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_select(id int, name varchar(50))"); myquery(rc); /* insert a row and commit the transaction */ - rc = mysql_query(mysql,"INSERT INTO test_select VALUES(10,'venu')"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "INSERT INTO test_select VALUES(10, 'venu')"); myquery(rc); /* now insert the second row, and rollback the transaction */ - rc = mysql_query(mysql,"INSERT INTO test_select VALUES(20,'mysql')"); + rc= mysql_query(mysql, "INSERT INTO test_select VALUES(20, 'mysql')"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); - strmov(query,"SELECT * FROM test_select WHERE id=? AND name=?"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "SELECT * FROM test_select WHERE id= ? AND name=?"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); + + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); /* string data */ - nData=10; - strmov(szData,(char *)"venu"); - bind[1].buffer_type=FIELD_TYPE_STRING; - bind[1].buffer=(char *)szData; + nData= 10; + strmov(szData, (char *)"venu"); + bind[1].buffer_type= MYSQL_TYPE_STRING; + bind[1].buffer= (char *)szData; bind[1].buffer_length= 4; bind[1].length= &length[1]; length[1]= 4; - bind[1].is_null=0; - bind[0].buffer=(char *)&nData; - bind[0].buffer_type=FIELD_TYPE_LONG; - bind[0].buffer_length= 0; - bind[0].length= 0; - bind[0].is_null= 0; + bind[0].buffer= (char *)&nData; + bind[0].buffer_type= MYSQL_TYPE_LONG; - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(my_process_stmt_result(stmt) == 1); @@ -1831,56 +1778,58 @@ static void test_select() mysql_stmt_close(stmt); } + /* - Test for BUG#3420 ("select id1,value1 from t where id=? or value=?" + Test for BUG#3420 ("select id1, value1 from t where id= ? or value= ?" returns all rows in the table) */ + static void test_ps_conj_select() { MYSQL_STMT *stmt; int rc; MYSQL_BIND bind[2]; long int int_data; - char str_data[32]; + char str_data[32]; unsigned long str_length; myheader("test_ps_conj_select"); - + rc= mysql_query(mysql, "drop table if exists t1"); myquery(rc); - - rc= mysql_query(mysql, "create table t1 (id1 int(11) NOT NULL default '0'," + + rc= mysql_query(mysql, "create table t1 (id1 int(11) NOT NULL default '0', " "value2 varchar(100), value1 varchar(100))"); myquery(rc); - rc= mysql_query(mysql, "insert into t1 values (1,'hh','hh'),(2,'hh','hh')," - "(1,'ii','ii'),(2,'ii','ii')"); + rc= mysql_query(mysql, "insert into t1 values (1, 'hh', 'hh'), " + "(2, 'hh', 'hh'), (1, 'ii', 'ii'), (2, 'ii', 'ii')"); myquery(rc); - - strmov(query, "select id1,value1 from t1 where id1=? or value1=?"); + + strmov(query, "select id1, value1 from t1 where id1= ? or value1= ?"); stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); + + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); bind[0].buffer_type= MYSQL_TYPE_LONG; bind[0].buffer= (char *)&int_data; - bind[0].is_null= 0; - bind[0].length= 0; bind[1].buffer_type= MYSQL_TYPE_VAR_STRING; bind[1].buffer= (char *)str_data; - bind[1].buffer_length= array_elements(str_data); - bind[1].is_null= 0; + bind[1].buffer_length= array_elements(str_data); bind[1].length= &str_length; - - rc = mysql_bind_param(stmt,bind); + + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); int_data= 1; - strcpy(str_data, "hh"); + strcpy(str_data, "hh"); str_length= strlen(str_data); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(my_process_stmt_result(stmt) == 3); @@ -1888,9 +1837,9 @@ static void test_ps_conj_select() mysql_stmt_close(stmt); } -/* - test BUG#1115 (incorrect string parameter value allocation) -*/ + +/* Test BUG#1115 (incorrect string parameter value allocation) */ + static void test_bug1115() { MYSQL_STMT *stmt; @@ -1901,69 +1850,91 @@ static void test_bug1115() myheader("test_bug1115"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_select"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_select"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_select(\ + rc= mysql_query(mysql, "CREATE TABLE test_select(\ session_id char(9) NOT NULL, \ a int(8) unsigned NOT NULL, \ b int(5) NOT NULL, \ c int(5) NOT NULL, \ d datetime NOT NULL)"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_select VALUES (\"abc\",1,2,3,2003-08-30), (\"abd\",1,2,3,2003-08-30), (\"abf\",1,2,3,2003-08-30), (\"abg\",1,2,3,2003-08-30), (\"abh\",1,2,3,2003-08-30), (\"abj\",1,2,3,2003-08-30), (\"abk\",1,2,3,2003-08-30), (\"abl\",1,2,3,2003-08-30), (\"abq\",1,2,3,2003-08-30), (\"abw\",1,2,3,2003-08-30), (\"abe\",1,2,3,2003-08-30), (\"abr\",1,2,3,2003-08-30), (\"abt\",1,2,3,2003-08-30), (\"aby\",1,2,3,2003-08-30), (\"abu\",1,2,3,2003-08-30), (\"abi\",1,2,3,2003-08-30), (\"abo\",1,2,3,2003-08-30), (\"abp\",1,2,3,2003-08-30), (\"abz\",1,2,3,2003-08-30), (\"abx\",1,2,3,2003-08-30)"); + rc= mysql_query(mysql, "INSERT INTO test_select VALUES " + "(\"abc\", 1, 2, 3, 2003-08-30), " + "(\"abd\", 1, 2, 3, 2003-08-30), " + "(\"abf\", 1, 2, 3, 2003-08-30), " + "(\"abg\", 1, 2, 3, 2003-08-30), " + "(\"abh\", 1, 2, 3, 2003-08-30), " + "(\"abj\", 1, 2, 3, 2003-08-30), " + "(\"abk\", 1, 2, 3, 2003-08-30), " + "(\"abl\", 1, 2, 3, 2003-08-30), " + "(\"abq\", 1, 2, 3, 2003-08-30), " + "(\"abw\", 1, 2, 3, 2003-08-30), " + "(\"abe\", 1, 2, 3, 2003-08-30), " + "(\"abr\", 1, 2, 3, 2003-08-30), " + "(\"abt\", 1, 2, 3, 2003-08-30), " + "(\"aby\", 1, 2, 3, 2003-08-30), " + "(\"abu\", 1, 2, 3, 2003-08-30), " + "(\"abi\", 1, 2, 3, 2003-08-30), " + "(\"abo\", 1, 2, 3, 2003-08-30), " + "(\"abp\", 1, 2, 3, 2003-08-30), " + "(\"abz\", 1, 2, 3, 2003-08-30), " + "(\"abx\", 1, 2, 3, 2003-08-30)"); myquery(rc); - strmov(query,"SELECT * FROM test_select WHERE session_id = ?"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "SELECT * FROM test_select WHERE session_id= ?"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,1); + verify_param_count(stmt, 1); - strmov(szData,(char *)"abc"); - bind[0].buffer_type=FIELD_TYPE_STRING; - bind[0].buffer=(char *)szData; + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); + + strmov(szData, (char *)"abc"); + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[0].buffer= (char *)szData; bind[0].buffer_length= 10; bind[0].length= &length[0]; length[0]= 3; - bind[0].is_null=0; - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(my_process_stmt_result(stmt) == 1); - strmov(szData,(char *)"venu"); - bind[0].buffer_type=FIELD_TYPE_STRING; - bind[0].buffer=(char *)szData; + strmov(szData, (char *)"venu"); + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[0].buffer= (char *)szData; bind[0].buffer_length= 10; bind[0].length= &length[0]; length[0]= 4; - bind[0].is_null=0; + bind[0].is_null= 0; - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(my_process_stmt_result(stmt) == 0); - strmov(szData,(char *)"abc"); - bind[0].buffer_type=FIELD_TYPE_STRING; - bind[0].buffer=(char *)szData; + strmov(szData, (char *)"abc"); + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[0].buffer= (char *)szData; bind[0].buffer_length= 10; bind[0].length= &length[0]; length[0]= 3; - bind[0].is_null=0; + bind[0].is_null= 0; - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(my_process_stmt_result(stmt) == 1); @@ -1971,9 +1942,9 @@ session_id char(9) NOT NULL, \ mysql_stmt_close(stmt); } -/* - test BUG#1180 (optimized away part of WHERE clause) -*/ + +/* Test BUG#1180 (optimized away part of WHERE clause) */ + static void test_bug1180() { MYSQL_STMT *stmt; @@ -1984,64 +1955,68 @@ static void test_bug1180() myheader("test_select_bug"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_select"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_select"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_select(session_id char(9) NOT NULL)"); + rc= mysql_query(mysql, "CREATE TABLE test_select(session_id char(9) NOT NULL)"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_select VALUES (\"abc\")"); + rc= mysql_query(mysql, "INSERT INTO test_select VALUES (\"abc\")"); myquery(rc); - strmov(query,"SELECT * FROM test_select WHERE ?=\"1111\" and session_id = \"abc\""); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "SELECT * FROM test_select WHERE ?= \"1111\" and " + "session_id= \"abc\""); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,1); + verify_param_count(stmt, 1); - strmov(szData,(char *)"abc"); - bind[0].buffer_type=FIELD_TYPE_STRING; - bind[0].buffer=(char *)szData; + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); + + strmov(szData, (char *)"abc"); + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[0].buffer= (char *)szData; bind[0].buffer_length= 10; bind[0].length= &length[0]; length[0]= 3; - bind[0].is_null=0; + bind[0].is_null= 0; - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(my_process_stmt_result(stmt) == 0); - strmov(szData,(char *)"1111"); - bind[0].buffer_type=FIELD_TYPE_STRING; - bind[0].buffer=(char *)szData; + strmov(szData, (char *)"1111"); + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[0].buffer= (char *)szData; bind[0].buffer_length= 10; bind[0].length= &length[0]; length[0]= 4; - bind[0].is_null=0; + bind[0].is_null= 0; - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(my_process_stmt_result(stmt) == 1); - strmov(szData,(char *)"abc"); - bind[0].buffer_type=FIELD_TYPE_STRING; - bind[0].buffer=(char *)szData; + strmov(szData, (char *)"abc"); + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[0].buffer= (char *)szData; bind[0].buffer_length= 10; bind[0].length= &length[0]; length[0]= 3; - bind[0].is_null=0; + bind[0].is_null= 0; - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(my_process_stmt_result(stmt) == 0); @@ -2049,10 +2024,12 @@ static void test_bug1180() mysql_stmt_close(stmt); } + /* - test BUG#1644 (Insertion of more than 3 NULL columns with - parameter binding fails) + Test BUG#1644 (Insertion of more than 3 NULL columns with parameter + binding fails) */ + static void test_bug1644() { MYSQL_STMT *stmt; @@ -2069,51 +2046,52 @@ static void test_bug1644() myquery(rc); rc= mysql_query(mysql, - "CREATE TABLE foo_dfr(col1 int, col2 int, col3 int, col4 int);"); + "CREATE TABLE foo_dfr(col1 int, col2 int, col3 int, col4 int);"); myquery(rc); - strmov(query, "INSERT INTO foo_dfr VALUES (?,?,?,? )"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO foo_dfr VALUES (?, ?, ?, ? )"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); verify_param_count(stmt, 4); + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); + num= 22; isnull= 0; - for (i = 0 ; i < 4 ; i++) + for (i= 0 ; i < 4 ; i++) { - bind[i].buffer_type= FIELD_TYPE_LONG; + bind[i].buffer_type= MYSQL_TYPE_LONG; bind[i].buffer= (char *)# - bind[i].buffer_length= 0; - bind[i].length= 0; bind[i].is_null= &isnull; } - rc= mysql_bind_param(stmt, bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); isnull= 1; - for (i = 0 ; i < 4 ; i++) + for (i= 0 ; i < 4 ; i++) bind[i].is_null= &isnull; - rc= mysql_bind_param(stmt, bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); isnull= 0; num= 88; - for (i = 0 ; i < 4 ; i++) + for (i= 0 ; i < 4 ; i++) bind[i].is_null= &isnull; - rc= mysql_bind_param(stmt, bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); mysql_stmt_close(stmt); @@ -2130,19 +2108,19 @@ static void test_bug1644() row= mysql_fetch_row(result); mytest(row); - for (i = 0 ; i < 4 ; i++) + for (i= 0 ; i < 4 ; i++) { assert(strcmp(row[i], "22") == 0); } row= mysql_fetch_row(result); mytest(row); - for (i = 0 ; i < 4 ; i++) + for (i= 0 ; i < 4 ; i++) { assert(row[i] == 0); } row= mysql_fetch_row(result); mytest(row); - for (i = 0 ; i < 4 ; i++) + for (i= 0 ; i < 4 ; i++) { assert(strcmp(row[i], "88") == 0); } @@ -2153,9 +2131,8 @@ static void test_bug1644() } -/******************************************************** -* to test simple select show * -*********************************************************/ +/* Test simple select show */ + static void test_select_show() { MYSQL_STMT *stmt; @@ -2163,51 +2140,52 @@ static void test_select_show() myheader("test_select_show"); - mysql_autocommit(mysql,TRUE); + mysql_autocommit(mysql, TRUE); - rc = mysql_query(mysql, "DROP TABLE IF EXISTS test_show"); - myquery(rc); - - rc = mysql_query(mysql, "CREATE TABLE test_show(id int(4) NOT NULL primary key, name char(2))"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_show"); myquery(rc); - stmt = mysql_simple_prepare(mysql, "show columns from test_show"); + rc= mysql_query(mysql, "CREATE TABLE test_show(id int(4) NOT NULL primary " + " key, name char(2))"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "show columns from test_show"); check_stmt(stmt); - verify_param_count(stmt,0); + verify_param_count(stmt, 0); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); my_process_stmt_result(stmt); mysql_stmt_close(stmt); - - stmt = mysql_simple_prepare(mysql, "show tables from mysql like ?"); + + stmt= mysql_simple_prepare(mysql, "show tables from mysql like ?"); check_stmt_r(stmt); - - strxmov(query,"show tables from ", current_db, " like \'test_show\'", NullS); - stmt = mysql_simple_prepare(mysql, query); + + strxmov(query, "show tables from ", current_db, " like \'test_show\'", NullS); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); my_process_stmt_result(stmt); mysql_stmt_close(stmt); - - stmt = mysql_simple_prepare(mysql, "describe test_show"); + + stmt= mysql_simple_prepare(mysql, "describe test_show"); check_stmt(stmt); - - rc = mysql_execute(stmt); + + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); my_process_stmt_result(stmt); mysql_stmt_close(stmt); - - stmt = mysql_simple_prepare(mysql, "show keys from test_show"); + + stmt= mysql_simple_prepare(mysql, "show keys from test_show"); check_stmt(stmt); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(1 == my_process_stmt_result(stmt)); @@ -2215,85 +2193,77 @@ static void test_select_show() } -/******************************************************** -* to test simple update * -*********************************************************/ +/* Test simple update */ + static void test_simple_update() { MYSQL_STMT *stmt; int rc; char szData[25]; - int nData=1; + int nData= 1; MYSQL_RES *result; - MYSQL_BIND bind[2]; - ulong length[2]; + MYSQL_BIND bind[2]; + ulong length[2]; myheader("test_simple_update"); - rc = mysql_autocommit(mysql,TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_update"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_update"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_update(col1 int, " + " col2 varchar(50), col3 int )"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_update(col1 int,\ - col2 varchar(50), col3 int )"); - myquery(rc); - - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"INSERT INTO test_update VALUES(1,'MySQL',100)"); + rc= mysql_query(mysql, "INSERT INTO test_update VALUES(1, 'MySQL', 100)"); myquery(rc); verify_affected_rows(1); - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* insert by prepare */ - strmov(query,"UPDATE test_update SET col2=? WHERE col1=?"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "UPDATE test_update SET col2= ? WHERE col1= ?"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); - nData=1; - bind[0].buffer_type=FIELD_TYPE_STRING; - bind[0].buffer=szData; /* string data */ - bind[0].buffer_length=sizeof(szData); + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); + + nData= 1; + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[0].buffer= szData; /* string data */ + bind[0].buffer_length= sizeof(szData); bind[0].length= &length[0]; - bind[0].is_null= 0; - length[0]= my_sprintf(szData, (szData,"updated-data")); + length[0]= my_sprintf(szData, (szData, "updated-data")); - bind[1].buffer=(char *) &nData; - bind[1].buffer_type=FIELD_TYPE_LONG; - bind[1].buffer_length= 0; - bind[1].length= 0; - bind[1].is_null= 0; + bind[1].buffer= (char *) &nData; + bind[1].buffer_type= MYSQL_TYPE_LONG; - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); verify_affected_rows(1); mysql_stmt_close(stmt); /* now fetch the results ..*/ - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* test the results now, only one row should exists */ - rc = mysql_query(mysql,"SELECT * FROM test_update"); + rc= mysql_query(mysql, "SELECT * FROM test_update"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(1 == my_process_result_set(result)); @@ -2301,203 +2271,185 @@ static void test_simple_update() } -/******************************************************** -* to test simple long data handling * -*********************************************************/ +/* Test simple long data handling */ + static void test_long_data() { MYSQL_STMT *stmt; int rc, int_data; - char *data=NullS; + char *data= NullS; MYSQL_RES *result; MYSQL_BIND bind[3]; myheader("test_long_data"); - rc = mysql_autocommit(mysql,TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_long_data"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_long_data"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_long_data(col1 int, " + " col2 long varchar, col3 long varbinary)"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_long_data(col1 int,\ - col2 long varchar, col3 long varbinary)"); - myquery(rc); - - rc = mysql_commit(mysql); - myquery(rc); - - strmov(query,"INSERT INTO test_long_data(col1,col2) VALUES(?)"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO test_long_data(col1, col2) VALUES(?)"); + stmt= mysql_simple_prepare(mysql, query); check_stmt_r(stmt); - strmov(query,"INSERT INTO test_long_data(col1,col2,col3) VALUES(?,?,?)"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO test_long_data(col1, col2, col3) VALUES(?, ?, ?)"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,3); + verify_param_count(stmt, 3); - bind[0].buffer=(char *)&int_data; - bind[0].buffer_type=FIELD_TYPE_LONG; - bind[0].is_null=0; - bind[0].buffer_length= 0; - bind[0].length= 0; + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); - bind[1].buffer_type=FIELD_TYPE_STRING; - bind[1].is_null=0; - bind[1].buffer_length=0; /* Will not be used */ - bind[1].length=0; /* Will not be used */ + bind[0].buffer= (char *)&int_data; + bind[0].buffer_type= MYSQL_TYPE_LONG; - bind[2]=bind[1]; - rc = mysql_bind_param(stmt,bind); + bind[1].buffer_type= MYSQL_TYPE_STRING; + + bind[2]= bind[1]; + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); int_data= 999; - data = (char *)"Michael"; + data= (char *)"Michael"; /* supply data in pieces */ - rc = mysql_send_long_data(stmt,1,data,strlen(data)); - data = (char *)" 'Monty' Widenius"; - rc = mysql_send_long_data(stmt,1,data,strlen(data)); + rc= mysql_stmt_send_long_data(stmt, 1, data, strlen(data)); + data= (char *)" 'Monty' Widenius"; + rc= mysql_stmt_send_long_data(stmt, 1, data, strlen(data)); check_execute(stmt, rc); - rc = mysql_send_long_data(stmt,2,"Venu (venu@mysql.com)",4); + rc= mysql_stmt_send_long_data(stmt, 2, "Venu (venu@mysql.com)", 4); check_execute(stmt, rc); /* execute */ - rc = mysql_execute(stmt); - fprintf(stdout," mysql_execute() returned %d\n",rc); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + fprintf(stdout, " mysql_stmt_execute() returned %d\n", rc); + check_execute(stmt, rc); - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* now fetch the results ..*/ - rc = mysql_query(mysql,"SELECT * FROM test_long_data"); + rc= mysql_query(mysql, "SELECT * FROM test_long_data"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(1 == my_process_result_set(result)); mysql_free_result(result); - verify_col_data("test_long_data","col1","999"); - verify_col_data("test_long_data","col2","Michael 'Monty' Widenius"); - verify_col_data("test_long_data","col3","Venu"); + verify_col_data("test_long_data", "col1", "999"); + verify_col_data("test_long_data", "col2", "Michael 'Monty' Widenius"); + verify_col_data("test_long_data", "col3", "Venu"); mysql_stmt_close(stmt); } -/******************************************************** -* to test long data (string) handling * -*********************************************************/ +/* Test long data (string) handling */ + static void test_long_data_str() { MYSQL_STMT *stmt; int rc, i; char data[255]; long length; - ulong length1; + ulong length1; MYSQL_RES *result; MYSQL_BIND bind[2]; my_bool is_null[2]; myheader("test_long_data_str"); - rc = mysql_autocommit(mysql,TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_long_data_str"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_long_data_str"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_long_data_str(id int, longstr long varchar)"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_long_data_str(id int, longstr long varchar)"); - myquery(rc); - - rc = mysql_commit(mysql); - myquery(rc); - - strmov(query,"INSERT INTO test_long_data_str VALUES(?,?)"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO test_long_data_str VALUES(?, ?)"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); - bind[0].buffer = (char *)&length; - bind[0].buffer_type = FIELD_TYPE_LONG; + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); + + bind[0].buffer= (char *)&length; + bind[0].buffer_type= MYSQL_TYPE_LONG; bind[0].is_null= &is_null[0]; - bind[0].buffer_length= 0; - bind[0].length= 0; - is_null[0]=0; + is_null[0]= 0; length= 0; - bind[1].buffer=data; /* string data */ - bind[1].buffer_type=FIELD_TYPE_STRING; + bind[1].buffer= data; /* string data */ + bind[1].buffer_type= MYSQL_TYPE_STRING; bind[1].length= &length1; - bind[1].buffer_length=0; /* Will not be used */ bind[1].is_null= &is_null[1]; - is_null[1]=0; - rc = mysql_bind_param(stmt,bind); + is_null[1]= 0; + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - length = 40; - strmov(data,"MySQL AB"); + length= 40; + strmov(data, "MySQL AB"); /* supply data in pieces */ - for(i=0; i < 4; i++) + for(i= 0; i < 4; i++) { - rc = mysql_send_long_data(stmt,1,(char *)data,5); + rc= mysql_stmt_send_long_data(stmt, 1, (char *)data, 5); check_execute(stmt, rc); } /* execute */ - rc = mysql_execute(stmt); - fprintf(stdout," mysql_execute() returned %d\n",rc); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + fprintf(stdout, " mysql_stmt_execute() returned %d\n", rc); + check_execute(stmt, rc); mysql_stmt_close(stmt); - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* now fetch the results ..*/ - rc = mysql_query(mysql,"SELECT LENGTH(longstr), longstr FROM test_long_data_str"); + rc= mysql_query(mysql, "SELECT LENGTH(longstr), longstr FROM test_long_data_str"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(1 == my_process_result_set(result)); mysql_free_result(result); - my_sprintf(data,(data,"%d", i*5)); - verify_col_data("test_long_data_str","LENGTH(longstr)", data); - data[0]='\0'; + my_sprintf(data, (data, "%d", i*5)); + verify_col_data("test_long_data_str", "LENGTH(longstr)", data); + data[0]= '\0'; while (i--) - strxmov(data,data,"MySQL",NullS); - verify_col_data("test_long_data_str","longstr", data); + strxmov(data, data, "MySQL", NullS); + verify_col_data("test_long_data_str", "longstr", data); - rc = mysql_query(mysql,"DROP TABLE test_long_data_str"); + rc= mysql_query(mysql, "DROP TABLE test_long_data_str"); myquery(rc); } -/******************************************************** -* to test long data (string) handling * -*********************************************************/ +/* Test long data (string) handling */ + static void test_long_data_str1() { MYSQL_STMT *stmt; int rc, i; char data[255]; long length; - ulong max_blob_length, blob_length, length1; + ulong max_blob_length, blob_length, length1; my_bool true_value; MYSQL_RES *result; MYSQL_BIND bind[2]; @@ -2505,67 +2457,63 @@ static void test_long_data_str1() myheader("test_long_data_str1"); - rc = mysql_autocommit(mysql,TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_long_data_str"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_long_data_str"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_long_data_str(longstr long varchar, blb long varbinary)"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_long_data_str(longstr long varchar,blb long varbinary)"); - myquery(rc); - - rc = mysql_commit(mysql); - myquery(rc); - - strmov(query,"INSERT INTO test_long_data_str VALUES(?,?)"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO test_long_data_str VALUES(?, ?)"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); - bind[0].buffer=data; /* string data */ + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); + + bind[0].buffer= data; /* string data */ bind[0].buffer_length= sizeof(data); bind[0].length= &length1; - bind[0].buffer_type=FIELD_TYPE_STRING; - bind[0].is_null= 0; + bind[0].buffer_type= MYSQL_TYPE_STRING; length1= 0; - bind[1] = bind[0]; - bind[1].buffer_type=FIELD_TYPE_BLOB; + bind[1]= bind[0]; + bind[1].buffer_type= MYSQL_TYPE_BLOB; - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - length = my_sprintf(data, (data, "MySQL AB")); + length= my_sprintf(data, (data, "MySQL AB")); /* supply data in pieces */ - for (i=0; i < 3; i++) + for (i= 0; i < 3; i++) { - rc = mysql_send_long_data(stmt,0,data,length); + rc= mysql_stmt_send_long_data(stmt, 0, data, length); check_execute(stmt, rc); - rc = mysql_send_long_data(stmt,1,data,2); + rc= mysql_stmt_send_long_data(stmt, 1, data, 2); check_execute(stmt, rc); } /* execute */ - rc = mysql_execute(stmt); - fprintf(stdout," mysql_execute() returned %d\n",rc); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + fprintf(stdout, " mysql_stmt_execute() returned %d\n", rc); + check_execute(stmt, rc); mysql_stmt_close(stmt); - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* now fetch the results ..*/ - rc = mysql_query(mysql,"SELECT LENGTH(longstr),longstr,LENGTH(blb),blb FROM test_long_data_str"); + rc= mysql_query(mysql, "SELECT LENGTH(longstr), longstr, LENGTH(blb), blb FROM test_long_data_str"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mysql_field_seek(result, 1); field= mysql_fetch_field(result); @@ -2576,24 +2524,24 @@ static void test_long_data_str1() assert(1 == my_process_result_set(result)); mysql_free_result(result); - my_sprintf(data,(data,"%ld",(long)i*length)); - verify_col_data("test_long_data_str","length(longstr)",data); + my_sprintf(data, (data, "%ld", (long)i*length)); + verify_col_data("test_long_data_str", "length(longstr)", data); - my_sprintf(data,(data,"%d",i*2)); - verify_col_data("test_long_data_str","length(blb)",data); + my_sprintf(data, (data, "%d", i*2)); + verify_col_data("test_long_data_str", "length(blb)", data); /* Test length of field->max_length */ stmt= mysql_simple_prepare(mysql, "SELECT * from test_long_data_str"); check_stmt(stmt); - verify_param_count(stmt,0); - - rc = mysql_execute(stmt); - check_execute(stmt,rc); + verify_param_count(stmt, 0); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); rc= mysql_stmt_store_result(stmt); - check_execute(stmt,rc); + check_execute(stmt, rc); - result= mysql_get_metadata(stmt); + result= mysql_stmt_result_metadata(stmt); field= mysql_fetch_fields(result); /* First test what happens if STMT_ATTR_UPDATE_MAX_LENGTH is not used */ @@ -2603,13 +2551,13 @@ static void test_long_data_str1() /* Enable updating of field->max_length */ true_value= 1; mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void*) &true_value); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); rc= mysql_stmt_store_result(stmt); - check_execute(stmt,rc); + check_execute(stmt, rc); - result= mysql_get_metadata(stmt); + result= mysql_stmt_result_metadata(stmt); field= mysql_fetch_fields(result); DBUG_ASSERT(field->max_length == max_blob_length); @@ -2620,10 +2568,10 @@ static void test_long_data_str1() bind[0].buffer= (char *) &data; /* this buffer won't be altered */ bind[0].buffer_length= 16; bind[0].length= &blob_length; - rc= mysql_bind_result(stmt,bind); + rc= mysql_stmt_bind_result(stmt, bind); data[16]= 0; - DBUG_ASSERT((mysql_fetch(stmt) == 0)); + DBUG_ASSERT((mysql_stmt_fetch(stmt) == 0)); DBUG_ASSERT(strlen(data) == 16); DBUG_ASSERT(blob_length == max_blob_length); @@ -2641,14 +2589,13 @@ static void test_long_data_str1() mysql_stmt_close(stmt); /* Drop created table */ - rc = mysql_query(mysql,"DROP TABLE test_long_data_str"); + rc= mysql_query(mysql, "DROP TABLE test_long_data_str"); myquery(rc); } -/******************************************************** -* to test long data (binary) handling * -*********************************************************/ +/* Test long data (binary) handling */ + static void test_long_data_bin() { MYSQL_STMT *stmt; @@ -2661,69 +2608,61 @@ static void test_long_data_bin() myheader("test_long_data_bin"); - rc = mysql_autocommit(mysql,TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_long_data_bin"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_long_data_bin"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_long_data_bin(id int, longbin long varbinary)"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_long_data_bin(id int, longbin long varbinary)"); - myquery(rc); - - rc = mysql_commit(mysql); - myquery(rc); - - strmov(query,"INSERT INTO test_long_data_bin VALUES(?,?)"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO test_long_data_bin VALUES(?, ?)"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); - bind[0].buffer = (char *)&length; - bind[0].buffer_type = FIELD_TYPE_LONG; - bind[0].buffer_length= 0; - bind[0].length= 0; - bind[0].is_null= 0; + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); + + bind[0].buffer= (char *)&length; + bind[0].buffer_type= MYSQL_TYPE_LONG; length= 0; - bind[1].buffer=data; /* string data */ - bind[1].buffer_type=FIELD_TYPE_LONG_BLOB; - bind[1].length= 0; /* Will not be used */ - bind[1].is_null= 0; - rc = mysql_bind_param(stmt,bind); + bind[1].buffer= data; /* string data */ + bind[1].buffer_type= MYSQL_TYPE_LONG_BLOB; + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - length = 10; - strmov(data,"MySQL AB"); + length= 10; + strmov(data, "MySQL AB"); /* supply data in pieces */ { int i; - for (i=0; i < 100; i++) + for (i= 0; i < 100; i++) { - rc = mysql_send_long_data(stmt,1,(char *)data,4); + rc= mysql_stmt_send_long_data(stmt, 1, (char *)data, 4); check_execute(stmt, rc); } } /* execute */ - rc = mysql_execute(stmt); - fprintf(stdout," mysql_execute() returned %d\n",rc); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + fprintf(stdout, " mysql_stmt_execute() returned %d\n", rc); + check_execute(stmt, rc); mysql_stmt_close(stmt); - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* now fetch the results ..*/ - rc = mysql_query(mysql,"SELECT LENGTH(longbin), longbin FROM test_long_data_bin"); + rc= mysql_query(mysql, "SELECT LENGTH(longbin), longbin FROM test_long_data_bin"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(1 == my_process_result_set(result)); @@ -2731,71 +2670,63 @@ static void test_long_data_bin() } -/******************************************************** -* to test simple delete * -*********************************************************/ +/* Test simple delete */ + static void test_simple_delete() { MYSQL_STMT *stmt; int rc; - char szData[30]={0}; - int nData=1; + char szData[30]= {0}; + int nData= 1; MYSQL_RES *result; MYSQL_BIND bind[2]; ulong length[2]; myheader("test_simple_delete"); - rc = mysql_autocommit(mysql,TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_simple_delete"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_simple_delete"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_simple_delete(col1 int,\ + rc= mysql_query(mysql, "CREATE TABLE test_simple_delete(col1 int, \ col2 varchar(50), col3 int )"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"INSERT INTO test_simple_delete VALUES(1,'MySQL',100)"); + rc= mysql_query(mysql, "INSERT INTO test_simple_delete VALUES(1, 'MySQL', 100)"); myquery(rc); verify_affected_rows(1); - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* insert by prepare */ - strmov(query,"DELETE FROM test_simple_delete WHERE col1=? AND col2=? AND col3=100"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "DELETE FROM test_simple_delete WHERE col1= ? AND col2= ? AND col3= 100"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); - nData=1; - strmov(szData,"MySQL"); - bind[1].buffer_type=FIELD_TYPE_STRING; - bind[1].buffer= szData; /* string data */ - bind[1].buffer_length=sizeof(szData); + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); + + nData= 1; + strmov(szData, "MySQL"); + bind[1].buffer_type= MYSQL_TYPE_STRING; + bind[1].buffer= szData; /* string data */ + bind[1].buffer_length= sizeof(szData); bind[1].length= &length[1]; - bind[1].is_null= 0; length[1]= 5; - bind[0].buffer=(char *)&nData; - bind[0].buffer_type=FIELD_TYPE_LONG; - bind[0].buffer_length= 0; - bind[0].length= 0; - bind[0].is_null= 0; + bind[0].buffer= (char *)&nData; + bind[0].buffer_type= MYSQL_TYPE_LONG; - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); verify_affected_rows(1); @@ -2803,15 +2734,15 @@ static void test_simple_delete() mysql_stmt_close(stmt); /* now fetch the results ..*/ - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* test the results now, only one row should exists */ - rc = mysql_query(mysql,"SELECT * FROM test_simple_delete"); + rc= mysql_query(mysql, "SELECT * FROM test_simple_delete"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(0 == my_process_result_set(result)); @@ -2819,105 +2750,98 @@ static void test_simple_delete() } +/* Test simple update */ -/******************************************************** -* to test simple update * -*********************************************************/ static void test_update() { MYSQL_STMT *stmt; int rc; char szData[25]; - int nData=1; + int nData= 1; MYSQL_RES *result; MYSQL_BIND bind[2]; ulong length[2]; myheader("test_update"); - rc = mysql_autocommit(mysql,TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_update"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_update"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_update(" + "col1 int primary key auto_increment, " + "col2 varchar(50), col3 int )"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_update(col1 int primary key auto_increment,\ - col2 varchar(50), col3 int )"); - myquery(rc); - - rc = mysql_commit(mysql); - myquery(rc); - - strmov(query,"INSERT INTO test_update(col2,col3) VALUES(?,?)"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO test_update(col2, col3) VALUES(?, ?)"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); + + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); /* string data */ - bind[0].buffer_type=FIELD_TYPE_STRING; - bind[0].buffer=szData; + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[0].buffer= szData; bind[0].buffer_length= sizeof(szData); bind[0].length= &length[0]; length[0]= my_sprintf(szData, (szData, "inserted-data")); - bind[0].is_null= 0; - bind[1].buffer=(char *)&nData; - bind[1].buffer_type=FIELD_TYPE_LONG; - bind[1].buffer_length= 0; - bind[1].length= 0; - bind[1].is_null= 0; + bind[1].buffer= (char *)&nData; + bind[1].buffer_type= MYSQL_TYPE_LONG; - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - nData=100; - rc = mysql_execute(stmt); + nData= 100; + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); verify_affected_rows(1); mysql_stmt_close(stmt); - strmov(query,"UPDATE test_update SET col2=? WHERE col3=?"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "UPDATE test_update SET col2= ? WHERE col3= ?"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); - nData=100; + verify_param_count(stmt, 2); + nData= 100; - bind[0].buffer_type=FIELD_TYPE_STRING; - bind[0].buffer=szData; + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); + + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[0].buffer= szData; bind[0].buffer_length= sizeof(szData); bind[0].length= &length[0]; length[0]= my_sprintf(szData, (szData, "updated-data")); - bind[1].buffer=(char *)&nData; - bind[1].buffer_type=FIELD_TYPE_LONG; - bind[1].buffer_length= 0; - bind[1].length= 0; - bind[1].is_null= 0; - rc = mysql_bind_param(stmt,bind); + bind[1].buffer= (char *)&nData; + bind[1].buffer_type= MYSQL_TYPE_LONG; + + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); verify_affected_rows(1); mysql_stmt_close(stmt); /* now fetch the results ..*/ - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* test the results now, only one row should exists */ - rc = mysql_query(mysql,"SELECT * FROM test_update"); + rc= mysql_query(mysql, "SELECT * FROM test_update"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(1 == my_process_result_set(result)); @@ -2925,9 +2849,8 @@ static void test_update() } -/******************************************************** -* to test simple prepare * -*********************************************************/ +/* Test prepare without parameters */ + static void test_prepare_noparam() { MYSQL_STMT *stmt; @@ -2936,38 +2859,35 @@ static void test_prepare_noparam() myheader("test_prepare_noparam"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS my_prepare"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS my_prepare"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE my_prepare(col1 int ,col2 varchar(50))"); + rc= mysql_query(mysql, "CREATE TABLE my_prepare(col1 int, col2 varchar(50))"); myquery(rc); - /* insert by prepare */ - strmov(query,"INSERT INTO my_prepare VALUES(10,'venu')"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO my_prepare VALUES(10, 'venu')"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,0); + verify_param_count(stmt, 0); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); mysql_stmt_close(stmt); /* now fetch the results ..*/ - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* test the results now, only one row should exists */ - rc = mysql_query(mysql,"SELECT * FROM my_prepare"); + rc= mysql_query(mysql, "SELECT * FROM my_prepare"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(1 == my_process_result_set(result)); @@ -2975,103 +2895,95 @@ static void test_prepare_noparam() } -/******************************************************** -* to test simple bind result * -*********************************************************/ +/* Test simple bind result */ + static void test_bind_result() { MYSQL_STMT *stmt; int rc; int nData; - ulong length, length1; + ulong length, length1; char szData[100]; MYSQL_BIND bind[2]; my_bool is_null[2]; myheader("test_bind_result"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_result"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_result"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_bind_result(col1 int , col2 varchar(50))"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_bind_result(col1 int ,col2 varchar(50))"); + rc= mysql_query(mysql, "INSERT INTO test_bind_result VALUES(10, 'venu')"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "INSERT INTO test_bind_result VALUES(20, 'MySQL')"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_bind_result VALUES(10,'venu')"); + rc= mysql_query(mysql, "INSERT INTO test_bind_result(col2) VALUES('monty')"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_bind_result VALUES(20,'MySQL')"); - myquery(rc); - - rc = mysql_query(mysql,"INSERT INTO test_bind_result(col2) VALUES('monty')"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* fetch */ - bind[0].buffer_type=FIELD_TYPE_LONG; - bind[0].buffer= (char *) &nData; /* integer data */ + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (char *) &nData; /* integer data */ bind[0].is_null= &is_null[0]; bind[0].length= 0; - bind[1].buffer_type=FIELD_TYPE_STRING; - bind[1].buffer=szData; /* string data */ - bind[1].buffer_length=sizeof(szData); + bind[1].buffer_type= MYSQL_TYPE_STRING; + bind[1].buffer= szData; /* string data */ + bind[1].buffer_length= sizeof(szData); bind[1].length= &length1; bind[1].is_null= &is_null[1]; - stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_bind_result"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_bind_result"); check_stmt(stmt); - rc = mysql_bind_result(stmt,bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout,"\n row 1: %d,%s(%lu)",nData, szData, length1); + fprintf(stdout, "\n row 1: %d, %s(%lu)", nData, szData, length1); assert(nData == 10); - assert(strcmp(szData,"venu")==0); + assert(strcmp(szData, "venu") == 0); assert(length1 == 4); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout,"\n row 2: %d,%s(%lu)",nData, szData, length1); + fprintf(stdout, "\n row 2: %d, %s(%lu)", nData, szData, length1); assert(nData == 20); - assert(strcmp(szData,"MySQL")==0); + assert(strcmp(szData, "MySQL") == 0); assert(length1 == 5); - length=99; - rc = mysql_fetch(stmt); - check_execute(stmt,rc); - + length= 99; + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); + if (is_null[0]) - fprintf(stdout,"\n row 3: NULL,%s(%lu)", szData, length1); + fprintf(stdout, "\n row 3: NULL, %s(%lu)", szData, length1); assert(is_null[0]); - assert(strcmp(szData,"monty")==0); + assert(strcmp(szData, "monty") == 0); assert(length1 == 5); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } -/******************************************************** -* to test ext bind result * -*********************************************************/ +/* Test ext bind result */ + static void test_bind_result_ext() { MYSQL_STMT *stmt; @@ -3085,33 +2997,28 @@ static void test_bind_result_ext() char szData[20], bData[20]; ulong szLength, bLength; MYSQL_BIND bind[8]; - ulong length[8]; + ulong length[8]; my_bool is_null[8]; myheader("test_bind_result_ext"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_result"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_result"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_bind_result(c1 tinyint, " + " c2 smallint, " + " c3 int, c4 bigint, " + " c5 float, c6 double, " + " c7 varbinary(10), " + " c8 varchar(50))"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, \ - c3 int, c4 bigint, \ - c5 float, c6 double, \ - c7 varbinary(10), \ - c8 varchar(50))"); + rc= mysql_query(mysql, "INSERT INTO test_bind_result " + "VALUES (19, 2999, 3999, 4999999, " + " 2345.6, 5678.89563, 'venu', 'mysql')"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999,\ - 2345.6,5678.89563,\ - 'venu','mysql')"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); for (i= 0; i < (int) array_elements(bind); i++) @@ -3120,45 +3027,45 @@ static void test_bind_result_ext() bind[i].is_null= &is_null[i]; } - bind[0].buffer_type=MYSQL_TYPE_TINY; - bind[0].buffer=(char *)&t_data; + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[0].buffer= (char *)&t_data; - bind[1].buffer_type=MYSQL_TYPE_SHORT; - bind[2].buffer_type=MYSQL_TYPE_LONG; - - bind[3].buffer_type=MYSQL_TYPE_LONGLONG; - bind[1].buffer=(char *)&s_data; - - bind[2].buffer=(char *)&i_data; - bind[3].buffer=(char *)&b_data; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; - bind[4].buffer_type=MYSQL_TYPE_FLOAT; - bind[4].buffer=(char *)&f_data; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + bind[1].buffer= (char *)&s_data; - bind[5].buffer_type=MYSQL_TYPE_DOUBLE; - bind[5].buffer=(char *)&d_data; + bind[2].buffer= (char *)&i_data; + bind[3].buffer= (char *)&b_data; - bind[6].buffer_type=MYSQL_TYPE_STRING; + bind[4].buffer_type= MYSQL_TYPE_FLOAT; + bind[4].buffer= (char *)&f_data; + + bind[5].buffer_type= MYSQL_TYPE_DOUBLE; + bind[5].buffer= (char *)&d_data; + + bind[6].buffer_type= MYSQL_TYPE_STRING; bind[6].buffer= (char *)szData; bind[6].buffer_length= sizeof(szData); bind[6].length= &szLength; - bind[7].buffer_type=MYSQL_TYPE_TINY_BLOB; - bind[7].buffer=(char *)&bData; + bind[7].buffer_type= MYSQL_TYPE_TINY_BLOB; + bind[7].buffer= (char *)&bData; bind[7].length= &bLength; bind[7].buffer_length= sizeof(bData); - stmt = mysql_simple_prepare(mysql, "select * from test_bind_result"); + stmt= mysql_simple_prepare(mysql, "select * from test_bind_result"); check_stmt(stmt); - rc = mysql_bind_result(stmt,bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); fprintf(stdout, "\n data (tiny) : %d", t_data); fprintf(stdout, "\n data (short) : %d", s_data); @@ -3180,25 +3087,24 @@ static void test_bind_result_ext() assert(b_data == 4999999); /*assert(f_data == 2345.60);*/ /*assert(d_data == 5678.89563);*/ - assert(strcmp(szData,"venu")==0); - assert(strncmp(bData,"mysql",5)==0); + assert(strcmp(szData, "venu") == 0); + assert(strncmp(bData, "mysql", 5) == 0); assert(szLength == 4); assert(bLength == 5); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } -/******************************************************** -* to test ext bind result * -*********************************************************/ +/* Test ext bind result */ + static void test_bind_result_ext1() { MYSQL_STMT *stmt; - uint i; + uint i; int rc; char t_data[20]; float s_data; @@ -3213,60 +3119,54 @@ static void test_bind_result_ext1() my_bool is_null[8]; myheader("test_bind_result_ext1"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_result"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_result"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, \ + rc= mysql_query(mysql, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, \ c3 int, c4 bigint, \ c5 float, c6 double, \ c7 varbinary(10), \ c8 varchar(10))"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "INSERT INTO test_bind_result VALUES(120, 2999, 3999, 54, \ + 2.6, 58.89, \ + '206', '6.7')"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_bind_result VALUES(120,2999,3999,54,\ - 2.6,58.89,\ - '206','6.7')"); + rc= mysql_commit(mysql); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - bind[0].buffer_type=MYSQL_TYPE_STRING; - bind[0].buffer=(char *) t_data; + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[0].buffer= (char *) t_data; bind[0].buffer_length= sizeof(t_data); - bind[1].buffer_type=MYSQL_TYPE_FLOAT; - bind[1].buffer=(char *)&s_data; + bind[1].buffer_type= MYSQL_TYPE_FLOAT; + bind[1].buffer= (char *)&s_data; bind[1].buffer_length= 0; - bind[2].buffer_type=MYSQL_TYPE_SHORT; - bind[2].buffer=(char *)&i_data; + bind[2].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer= (char *)&i_data; bind[2].buffer_length= 0; - bind[3].buffer_type=MYSQL_TYPE_TINY; - bind[3].buffer=(char *)&b_data; + bind[3].buffer_type= MYSQL_TYPE_TINY; + bind[3].buffer= (char *)&b_data; bind[3].buffer_length= 0; - bind[4].buffer_type=MYSQL_TYPE_LONG; - bind[4].buffer=(char *)&f_data; + bind[4].buffer_type= MYSQL_TYPE_LONG; + bind[4].buffer= (char *)&f_data; bind[4].buffer_length= 0; - bind[5].buffer_type=MYSQL_TYPE_STRING; - bind[5].buffer=(char *)d_data; + bind[5].buffer_type= MYSQL_TYPE_STRING; + bind[5].buffer= (char *)d_data; bind[5].buffer_length= sizeof(d_data); - bind[6].buffer_type=MYSQL_TYPE_LONG; - bind[6].buffer=(char *)&bData; + bind[6].buffer_type= MYSQL_TYPE_LONG; + bind[6].buffer= (char *)&bData; bind[6].buffer_length= 0; - bind[7].buffer_type=MYSQL_TYPE_DOUBLE; - bind[7].buffer=(char *)&szData; + bind[7].buffer_type= MYSQL_TYPE_DOUBLE; + bind[7].buffer= (char *)&szData; bind[7].buffer_length= 0; for (i= 0; i < array_elements(bind); i++) @@ -3275,17 +3175,17 @@ static void test_bind_result_ext1() bind[i].length= &length[i]; } - stmt = mysql_simple_prepare(mysql, "select * from test_bind_result"); + stmt= mysql_simple_prepare(mysql, "select * from test_bind_result"); check_stmt(stmt); - rc = mysql_bind_result(stmt,bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); fprintf(stdout, "\n data (tiny) : %s(%lu)", t_data, length[0]); fprintf(stdout, "\n data (short) : %f(%lu)", s_data, length[1]); @@ -3298,10 +3198,10 @@ static void test_bind_result_ext1() fprintf(stdout, "\n data (bin) : %ld(%lu)", bData, length[6]); fprintf(stdout, "\n data (str) : %g(%lu)", szData, length[7]); - assert(strcmp(t_data,"120")==0); + assert(strcmp(t_data, "120") == 0); assert(i_data == 3999); assert(f_data == 2); - assert(strcmp(d_data,"58.89")==0); + assert(strcmp(d_data, "58.89") == 0); assert(b_data == 54); assert(length[0] == 3); @@ -3313,56 +3213,58 @@ static void test_bind_result_ext1() assert(length[6] == 4); assert(length[7] == 8); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } -/* - Generalized fetch conversion routine for all basic types -*/ + +/* Generalized fetch conversion routine for all basic types */ + static void bind_fetch(int row_count) -{ +{ MYSQL_STMT *stmt; int rc, i, count= row_count; - ulong bit; + ulong bit; long data[10]; float f_data; double d_data; char s_data[10]; - ulong length[10]; + ulong length[10]; MYSQL_BIND bind[7]; - my_bool is_null[7]; + my_bool is_null[7]; - stmt = mysql_simple_prepare(mysql,"INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)"); + stmt= mysql_simple_prepare(mysql, "INSERT INTO test_bind_fetch VALUES " + "(?, ?, ?, ?, ?, ?, ?)"); check_stmt(stmt); verify_param_count(stmt, 7); - + + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); + for (i= 0; i < (int) array_elements(bind); i++) - { + { bind[i].buffer_type= MYSQL_TYPE_LONG; bind[i].buffer= (char *) &data[i]; - bind[i].length= 0; - bind[i].is_null= 0; - } - rc = mysql_bind_param(stmt, bind); - check_execute(stmt,rc); - + } + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); + while (count--) { rc= 10+count; for (i= 0; i < (int) array_elements(bind); i++) - { + { data[i]= rc+i; rc+= 12; } - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); } - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); mysql_stmt_close(stmt); @@ -3370,7 +3272,7 @@ static void bind_fetch(int row_count) assert(row_count == (int) my_stmt_result("SELECT * FROM test_bind_fetch")); - stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_bind_fetch"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_bind_fetch"); myquery(rc); for (i= 0; i < (int) array_elements(bind); i++) @@ -3395,19 +3297,19 @@ static void bind_fetch(int row_count) bind[6].buffer= (char *)&s_data; bind[6].buffer_length= sizeof(s_data); - rc = mysql_bind_result(stmt, bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_stmt_store_result(stmt); + rc= mysql_stmt_store_result(stmt); check_execute(stmt, rc); while (row_count--) { - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); fprintf(stdout, "\n"); fprintf(stdout, "\n tiny : %ld(%lu)", data[0], length[0]); @@ -3420,7 +3322,7 @@ static void bind_fetch(int row_count) bit= 1; rc= 10+row_count; - for (i=0; i < 4; i++) + for (i= 0; i < 4; i++) { assert(data[i] == rc+i); assert(length[i] == bit); @@ -3443,40 +3345,37 @@ static void bind_fetch(int row_count) { char buff[20]; long len= my_sprintf(buff, (buff, "%d", rc)); - assert(strcmp(s_data,buff)==0); + assert(strcmp(s_data, buff) == 0); assert(length[6] == (ulong) len); } } - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } -/******************************************************** -* to test fetching of date, time and ts * -*********************************************************/ + +/* Test fetching of date, time and ts */ + static void test_fetch_date() { MYSQL_STMT *stmt; - uint i; + uint i; int rc, year; char date[25], time[25], ts[25], ts_4[15], ts_6[20], dt[20]; - ulong d_length, t_length, ts_length, ts4_length, ts6_length, + ulong d_length, t_length, ts_length, ts4_length, ts6_length, dt_length, y_length; MYSQL_BIND bind[8]; my_bool is_null[8]; - ulong length[8]; + ulong length[8]; myheader("test_fetch_date"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_result"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_result"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_bind_result(c1 date, c2 time, \ + rc= mysql_query(mysql, "CREATE TABLE test_bind_result(c1 date, c2 time, \ c3 timestamp(14), \ c4 year, \ c5 datetime, \ @@ -3484,18 +3383,15 @@ static void test_fetch_date() c7 timestamp(6))"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"INSERT INTO test_bind_result VALUES('2002-01-02',\ - '12:49:00',\ + rc= mysql_query(mysql, "INSERT INTO test_bind_result VALUES('2002-01-02', \ + '12:49:00', \ '2002-01-02 17:46:59', \ - 2010,\ + 2010, \ '2010-07-10', \ - '2020','1999-12-29')"); + '2020', '1999-12-29')"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); for (i= 0; i < array_elements(bind); i++) @@ -3504,54 +3400,54 @@ static void test_fetch_date() bind[i].length= &length[i]; } - bind[0].buffer_type=MYSQL_TYPE_STRING; - bind[1]=bind[2]=bind[0]; + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[1]= bind[2]= bind[0]; - bind[0].buffer=(char *)&date; + bind[0].buffer= (char *)&date; bind[0].buffer_length= sizeof(date); bind[0].length= &d_length; - bind[1].buffer=(char *)&time; + bind[1].buffer= (char *)&time; bind[1].buffer_length= sizeof(time); bind[1].length= &t_length; - bind[2].buffer=(char *)&ts; + bind[2].buffer= (char *)&ts; bind[2].buffer_length= sizeof(ts); bind[2].length= &ts_length; - bind[3].buffer_type=MYSQL_TYPE_LONG; - bind[3].buffer=(char *)&year; + bind[3].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer= (char *)&year; bind[3].length= &y_length; - bind[4].buffer_type=MYSQL_TYPE_STRING; - bind[4].buffer=(char *)&dt; + bind[4].buffer_type= MYSQL_TYPE_STRING; + bind[4].buffer= (char *)&dt; bind[4].buffer_length= sizeof(dt); bind[4].length= &dt_length; - bind[5].buffer_type=MYSQL_TYPE_STRING; - bind[5].buffer=(char *)&ts_4; + bind[5].buffer_type= MYSQL_TYPE_STRING; + bind[5].buffer= (char *)&ts_4; bind[5].buffer_length= sizeof(ts_4); bind[5].length= &ts4_length; - bind[6].buffer_type=MYSQL_TYPE_STRING; - bind[6].buffer=(char *)&ts_6; + bind[6].buffer_type= MYSQL_TYPE_STRING; + bind[6].buffer= (char *)&ts_6; bind[6].buffer_length= sizeof(ts_6); bind[6].length= &ts6_length; assert(1 == my_stmt_result("SELECT * FROM test_bind_result")); - stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_bind_result"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_bind_result"); check_stmt(stmt); - rc = mysql_bind_result(stmt,bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + ts_4[0]= '\0'; + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - - ts_4[0]='\0'; - rc = mysql_fetch(stmt); - check_execute(stmt,rc); fprintf(stdout, "\n date : %s(%lu)", date, d_length); fprintf(stdout, "\n time : %s(%lu)", time, t_length); @@ -3561,371 +3457,313 @@ static void test_fetch_date() fprintf(stdout, "\n ts(4) : %s(%lu)", ts_4, ts4_length); fprintf(stdout, "\n ts(6) : %s(%lu)", ts_6, ts6_length); - assert(strcmp(date,"2002-01-02")==0); + assert(strcmp(date, "2002-01-02") == 0); assert(d_length == 10); - assert(strcmp(time,"12:49:00")==0); + assert(strcmp(time, "12:49:00") == 0); assert(t_length == 8); - assert(strcmp(ts,"2002-01-02 17:46:59")==0); + assert(strcmp(ts, "2002-01-02 17:46:59") == 0); assert(ts_length == 19); assert(year == 2010); assert(y_length == 4); - - assert(strcmp(dt,"2010-07-10 00:00:00")==0); + + assert(strcmp(dt, "2010-07-10 00:00:00") == 0); assert(dt_length == 19); assert(ts_4[0] == '\0'); assert(ts4_length == 0); - assert(strcmp(ts_6,"1999-12-29 00:00:00")==0); + assert(strcmp(ts_6, "1999-12-29 00:00:00") == 0); assert(ts6_length == 19); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } -/******************************************************** -* to test fetching of str to all types * -*********************************************************/ + +/* Test fetching of str to all types */ + static void test_fetch_str() { int rc; myheader("test_fetch_str"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_fetch"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_fetch"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_bind_fetch(c1 char(10),\ - c2 char(10),\ - c3 char(20),\ - c4 char(20),\ - c5 char(30),\ - c6 char(40),\ + rc= mysql_query(mysql, "CREATE TABLE test_bind_fetch(c1 char(10), \ + c2 char(10), \ + c3 char(20), \ + c4 char(20), \ + c5 char(30), \ + c6 char(40), \ c7 char(20))"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - bind_fetch(3); } -/******************************************************** -* to test fetching of long to all types * -*********************************************************/ + +/* Test fetching of long to all types */ + static void test_fetch_long() { int rc; myheader("test_fetch_long"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_fetch"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_fetch"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_bind_fetch(c1 int unsigned,\ - c2 int unsigned,\ - c3 int,\ - c4 int,\ - c5 int,\ - c6 int unsigned,\ + rc= mysql_query(mysql, "CREATE TABLE test_bind_fetch(c1 int unsigned, \ + c2 int unsigned, \ + c3 int, \ + c4 int, \ + c5 int, \ + c6 int unsigned, \ c7 int)"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - bind_fetch(4); } -/******************************************************** -* to test fetching of short to all types * -*********************************************************/ +/* Test fetching of short to all types */ + static void test_fetch_short() { int rc; myheader("test_fetch_short"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_fetch"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_fetch"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,\ - c2 smallint,\ - c3 smallint unsigned,\ - c4 smallint,\ - c5 smallint,\ - c6 smallint,\ + rc= mysql_query(mysql, "CREATE TABLE test_bind_fetch(c1 smallint unsigned, \ + c2 smallint, \ + c3 smallint unsigned, \ + c4 smallint, \ + c5 smallint, \ + c6 smallint, \ c7 smallint unsigned)"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - bind_fetch(5); } -/******************************************************** -* to test fetching of tiny to all types * -*********************************************************/ +/* Test fetching of tiny to all types */ + static void test_fetch_tiny() { int rc; myheader("test_fetch_tiny"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_fetch"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_fetch"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_bind_fetch(c1 tinyint unsigned,\ - c2 tinyint,\ - c3 tinyint unsigned,\ - c4 tinyint,\ - c5 tinyint,\ - c6 tinyint,\ + rc= mysql_query(mysql, "CREATE TABLE test_bind_fetch(c1 tinyint unsigned, \ + c2 tinyint, \ + c3 tinyint unsigned, \ + c4 tinyint, \ + c5 tinyint, \ + c6 tinyint, \ c7 tinyint unsigned)"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - bind_fetch(3); } -/******************************************************** -* to test fetching of longlong to all types * -*********************************************************/ +/* Test fetching of longlong to all types */ + static void test_fetch_bigint() { int rc; myheader("test_fetch_bigint"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_fetch"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_fetch"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_bind_fetch(c1 bigint,\ - c2 bigint,\ - c3 bigint unsigned,\ - c4 bigint unsigned,\ - c5 bigint unsigned,\ - c6 bigint unsigned,\ + rc= mysql_query(mysql, "CREATE TABLE test_bind_fetch(c1 bigint, \ + c2 bigint, \ + c3 bigint unsigned, \ + c4 bigint unsigned, \ + c5 bigint unsigned, \ + c6 bigint unsigned, \ c7 bigint unsigned)"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - bind_fetch(2); } -/******************************************************** -* to test fetching of float to all types * -*********************************************************/ +/* Test fetching of float to all types */ + static void test_fetch_float() { int rc; myheader("test_fetch_float"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_fetch"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_fetch"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_bind_fetch(c1 float(3),\ - c2 float,\ - c3 float unsigned,\ - c4 float,\ - c5 float,\ - c6 float,\ + rc= mysql_query(mysql, "CREATE TABLE test_bind_fetch(c1 float(3), \ + c2 float, \ + c3 float unsigned, \ + c4 float, \ + c5 float, \ + c6 float, \ c7 float(10) unsigned)"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - bind_fetch(2); } -/******************************************************** -* to test fetching of double to all types * -*********************************************************/ + +/* Test fetching of double to all types */ + static void test_fetch_double() { int rc; myheader("test_fetch_double"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_fetch"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_fetch"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_bind_fetch(c1 double(5, 2), " + "c2 double unsigned, c3 double unsigned, " + "c4 double unsigned, c5 double unsigned, " + "c6 double unsigned, c7 double unsigned)"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_bind_fetch(c1 double(5,2),\ - c2 double unsigned,\ - c3 double unsigned,\ - c4 double unsigned,\ - c5 double unsigned,\ - c6 double unsigned,\ - c7 double unsigned)"); - myquery(rc); - - rc = mysql_commit(mysql); - myquery(rc); - bind_fetch(3); } -/******************************************************** -* to test simple prepare with all possible types * -*********************************************************/ + +/* Test simple prepare with all possible types */ + static void test_prepare_ext() { MYSQL_STMT *stmt; - uint i; int rc; char *sql; - int nData=1; - char tData=1; - short sData=10; - longlong bData=20; + int nData= 1; + char tData= 1; + short sData= 10; + longlong bData= 20; MYSQL_BIND bind[6]; myheader("test_prepare_ext"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prepare_ext"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prepare_ext"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); + sql= (char *)"CREATE TABLE test_prepare_ext\ + (\ + c1 tinyint, \ + c2 smallint, \ + c3 mediumint, \ + c4 int, \ + c5 integer, \ + c6 bigint, \ + c7 float, \ + c8 double, \ + c9 double precision, \ + c10 real, \ + c11 decimal(7, 4), \ + c12 numeric(8, 4), \ + c13 date, \ + c14 datetime, \ + c15 timestamp(14), \ + c16 time, \ + c17 year, \ + c18 bit, \ + c19 bool, \ + c20 char, \ + c21 char(10), \ + c22 varchar(30), \ + c23 tinyblob, \ + c24 tinytext, \ + c25 blob, \ + c26 text, \ + c27 mediumblob, \ + c28 mediumtext, \ + c29 longblob, \ + c30 longtext, \ + c31 enum('one', 'two', 'three'), \ + c32 set('monday', 'tuesday', 'wednesday'))"; - sql = (char *)"CREATE TABLE test_prepare_ext\ - (\ - c1 tinyint,\ - c2 smallint,\ - c3 mediumint,\ - c4 int,\ - c5 integer,\ - c6 bigint,\ - c7 float,\ - c8 double,\ - c9 double precision,\ - c10 real,\ - c11 decimal(7,4),\ - c12 numeric(8,4),\ - c13 date,\ - c14 datetime,\ - c15 timestamp(14),\ - c16 time,\ - c17 year,\ - c18 bit,\ - c19 bool,\ - c20 char,\ - c21 char(10),\ - c22 varchar(30),\ - c23 tinyblob,\ - c24 tinytext,\ - c25 blob,\ - c26 text,\ - c27 mediumblob,\ - c28 mediumtext,\ - c29 longblob,\ - c30 longtext,\ - c31 enum('one','two','three'),\ - c32 set('monday','tuesday','wednesday'))"; - - rc = mysql_query(mysql,sql); + rc= mysql_query(mysql, sql); myquery(rc); /* insert by prepare - all integers */ - strmov(query,(char *)"INSERT INTO test_prepare_ext(c1,c2,c3,c4,c5,c6) VALUES(?,?,?,?,?,?)"); - stmt = mysql_simple_prepare(mysql,query); + strmov(query, (char *)"INSERT INTO test_prepare_ext(c1, c2, c3, c4, c5, c6) VALUES(?, ?, ?, ?, ?, ?)"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,6); + verify_param_count(stmt, 6); + + /* Always bzero all members of bind parameter */ + bzero((char*) bind, sizeof(bind)); /*tinyint*/ - bind[0].buffer_type=FIELD_TYPE_TINY; + bind[0].buffer_type= MYSQL_TYPE_TINY; bind[0].buffer= (char *)&tData; /*smallint*/ - bind[1].buffer_type=FIELD_TYPE_SHORT; + bind[1].buffer_type= MYSQL_TYPE_SHORT; bind[1].buffer= (char *)&sData; /*mediumint*/ - bind[2].buffer_type=FIELD_TYPE_LONG; + bind[2].buffer_type= MYSQL_TYPE_LONG; bind[2].buffer= (char *)&nData; /*int*/ - bind[3].buffer_type=FIELD_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONG; bind[3].buffer= (char *)&nData; /*integer*/ - bind[4].buffer_type=FIELD_TYPE_LONG; + bind[4].buffer_type= MYSQL_TYPE_LONG; bind[4].buffer= (char *)&nData; /*bigint*/ - bind[5].buffer_type=FIELD_TYPE_LONGLONG; + bind[5].buffer_type= MYSQL_TYPE_LONGLONG; bind[5].buffer= (char *)&bData; - for (i= 0; i < array_elements(bind); i++) - { - bind[i].is_null=0; - bind[i].buffer_length= 0; - bind[i].length= 0; - } - - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); /* * integer to integer */ - for (nData=0; nData<10; nData++, tData++, sData++,bData++) + for (nData= 0; nData<10; nData++, tData++, sData++, bData++) { - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); } mysql_stmt_close(stmt); /* now fetch the results ..*/ - rc = mysql_commit(mysql); - myquery(rc); - stmt = mysql_simple_prepare(mysql,"SELECT c1,c2,c3,c4,c5,c6 FROM test_prepare_ext"); + stmt= mysql_simple_prepare(mysql, "SELECT c1, c2, c3, c4, c5, c6 " + "FROM test_prepare_ext"); check_stmt(stmt); /* get the result */ - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(nData == (int)my_process_stmt_result(stmt)); @@ -3934,10 +3772,8 @@ static void test_prepare_ext() } +/* Test real and alias names */ -/******************************************************** -* to test real and alias names * -*********************************************************/ static void test_field_names() { int rc; @@ -3945,49 +3781,43 @@ static void test_field_names() myheader("test_field_names"); - fprintf(stdout,"\n %d,%d,%d",MYSQL_TYPE_DECIMAL,MYSQL_TYPE_NEWDATE,MYSQL_TYPE_ENUM); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_field_names1"); + fprintf(stdout, "\n %d, %d, %d", MYSQL_TYPE_DECIMAL, MYSQL_TYPE_NEWDATE, MYSQL_TYPE_ENUM); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_field_names1"); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_field_names2"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_field_names2"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_field_names1(id int, name varchar(50))"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_field_names1(id int,name varchar(50))"); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_field_names2(id int,name varchar(50))"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_field_names2(id int, name varchar(50))"); myquery(rc); /* with table name included with TRUE column name */ - rc = mysql_query(mysql,"SELECT id as 'id-alias' FROM test_field_names1"); + rc= mysql_query(mysql, "SELECT id as 'id-alias' FROM test_field_names1"); myquery(rc); - result = mysql_use_result(mysql); + result= mysql_use_result(mysql); mytest(result); assert(0 == my_process_result_set(result)); mysql_free_result(result); /* with table name included with TRUE column name */ - rc = mysql_query(mysql,"SELECT t1.id as 'id-alias',test_field_names2.name FROM test_field_names1 t1,test_field_names2"); + rc= mysql_query(mysql, "SELECT t1.id as 'id-alias', test_field_names2.name FROM test_field_names1 t1, test_field_names2"); myquery(rc); - result = mysql_use_result(mysql); + result= mysql_use_result(mysql); mytest(result); assert(0 == my_process_result_set(result)); mysql_free_result(result); } -/******************************************************** -* to test warnings * -*********************************************************/ + +/* Test warnings */ + static void test_warnings() { int rc; @@ -3997,23 +3827,23 @@ static void test_warnings() mysql_query(mysql, "DROP TABLE if exists test_non_exists"); - rc = mysql_query(mysql, "DROP TABLE if exists test_non_exists"); + rc= mysql_query(mysql, "DROP TABLE if exists test_non_exists"); myquery(rc); fprintf(stdout, "\n total warnings: %d", mysql_warning_count(mysql)); - rc = mysql_query(mysql,"SHOW WARNINGS"); + rc= mysql_query(mysql, "SHOW WARNINGS"); myquery(rc); - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(1 == my_process_result_set(result)); mysql_free_result(result); } -/******************************************************** -* to test errors * -*********************************************************/ + +/* Test errors */ + static void test_errors() { int rc; @@ -4023,13 +3853,13 @@ static void test_errors() mysql_query(mysql, "DROP TABLE if exists test_non_exists"); - rc = mysql_query(mysql, "DROP TABLE test_non_exists"); + rc= mysql_query(mysql, "DROP TABLE test_non_exists"); myquery_r(rc); - rc = mysql_query(mysql,"SHOW ERRORS"); + rc= mysql_query(mysql, "SHOW ERRORS"); myquery(rc); - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); my_process_result_set(result); @@ -4037,10 +3867,8 @@ static void test_errors() } +/* Test simple prepare-insert */ -/******************************************************** -* to test simple prepare-insert * -*********************************************************/ static void test_insert() { MYSQL_STMT *stmt; @@ -4049,65 +3877,66 @@ static void test_insert() char tiny_data; MYSQL_RES *result; MYSQL_BIND bind[2]; - ulong length; + ulong length; myheader("test_insert"); - rc = mysql_autocommit(mysql, TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prep_insert"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prep_insert"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_prep_insert(col1 tinyint,\ + rc= mysql_query(mysql, "CREATE TABLE test_prep_insert(col1 tinyint, \ col2 varchar(50))"); myquery(rc); /* insert by prepare */ - stmt = mysql_simple_prepare(mysql, "INSERT INTO test_prep_insert VALUES(?,?)"); + stmt= mysql_simple_prepare(mysql, + "INSERT INTO test_prep_insert VALUES(?, ?)"); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); + + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); /* tinyint */ - bind[0].buffer_type=FIELD_TYPE_TINY; - bind[0].buffer=(char *)&tiny_data; - bind[0].is_null= 0; - bind[0].length= 0; + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[0].buffer= (char *)&tiny_data; /* string */ - bind[1].buffer_type=FIELD_TYPE_STRING; - bind[1].buffer=str_data; - bind[1].buffer_length=sizeof(str_data);; - bind[1].is_null= 0; + bind[1].buffer_type= MYSQL_TYPE_STRING; + bind[1].buffer= str_data; + bind[1].buffer_length= sizeof(str_data);; bind[1].length= &length; - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); /* now, execute the prepared statement to insert 10 records.. */ - for (tiny_data=0; tiny_data < 3; tiny_data++) + for (tiny_data= 0; tiny_data < 3; tiny_data++) { - length = my_sprintf(str_data, (str_data, "MySQL%d",tiny_data)); - rc = mysql_execute(stmt); + length= my_sprintf(str_data, (str_data, "MySQL%d", tiny_data)); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); } mysql_stmt_close(stmt); /* now fetch the results ..*/ - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* test the results now, only one row should exists */ - rc = mysql_query(mysql,"SELECT * FROM test_prep_insert"); + rc= mysql_query(mysql, "SELECT * FROM test_prep_insert"); myquery(rc); /* get the result */ - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert((int)tiny_data == my_process_result_set(result)); @@ -4115,9 +3944,9 @@ static void test_insert() } -/******************************************************** -* to test simple prepare-resultset info * -*********************************************************/ + +/* Test simple prepare-resultset info */ + static void test_prepare_resultset() { MYSQL_STMT *stmt; @@ -4126,34 +3955,30 @@ static void test_prepare_resultset() myheader("test_prepare_resultset"); - rc = mysql_autocommit(mysql, TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prepare_resultset"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prepare_resultset"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_prepare_resultset(id int, \ + name varchar(50), extra double)"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_prepare_resultset(id int,\ - name varchar(50),extra double)"); - myquery(rc); - - stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_prepare_resultset"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_prepare_resultset"); check_stmt(stmt); - verify_param_count(stmt,0); + verify_param_count(stmt, 0); - result = mysql_get_metadata(stmt); + result= mysql_stmt_result_metadata(stmt); mytest(result); my_print_result_metadata(result); mysql_free_result(result); mysql_stmt_close(stmt); } -/******************************************************** -* to test field flags (verify .NET provider) * -*********************************************************/ + +/* Test field flags (verify .NET provider) */ static void test_field_flags() { @@ -4165,56 +3990,50 @@ static void test_field_flags() myheader("test_field_flags"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_field_flags"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_field_flags"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_field_flags(id int NOT NULL AUTO_INCREMENT PRIMARY KEY,\ - id1 int NOT NULL,\ - id2 int UNIQUE,\ - id3 int,\ - id4 int NOT NULL,\ - id5 int,\ - KEY(id3,id4))"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_field_flags(id int NOT NULL AUTO_INCREMENT PRIMARY KEY, \ + id1 int NOT NULL, \ + id2 int UNIQUE, \ + id3 int, \ + id4 int NOT NULL, \ + id5 int, \ + KEY(id3, id4))"); myquery(rc); /* with table name included with TRUE column name */ - rc = mysql_query(mysql,"SELECT * FROM test_field_flags"); + rc= mysql_query(mysql, "SELECT * FROM test_field_flags"); myquery(rc); - result = mysql_use_result(mysql); + result= mysql_use_result(mysql); mytest(result); - mysql_field_seek(result,0); - fputc('\n', stdout); + mysql_field_seek(result, 0); + fputc('\n', stdout); - for(i=0; i< mysql_num_fields(result); i++) + for(i= 0; i< mysql_num_fields(result); i++) { - field = mysql_fetch_field(result); - fprintf(stdout,"\n field:%d",i); + field= mysql_fetch_field(result); + fprintf(stdout, "\n field:%d", i); if (field->flags & NOT_NULL_FLAG) - fprintf(stdout,"\n NOT_NULL_FLAG"); + fprintf(stdout, "\n NOT_NULL_FLAG"); if (field->flags & PRI_KEY_FLAG) - fprintf(stdout,"\n PRI_KEY_FLAG"); + fprintf(stdout, "\n PRI_KEY_FLAG"); if (field->flags & UNIQUE_KEY_FLAG) - fprintf(stdout,"\n UNIQUE_KEY_FLAG"); + fprintf(stdout, "\n UNIQUE_KEY_FLAG"); if (field->flags & MULTIPLE_KEY_FLAG) - fprintf(stdout,"\n MULTIPLE_KEY_FLAG"); + fprintf(stdout, "\n MULTIPLE_KEY_FLAG"); if (field->flags & AUTO_INCREMENT_FLAG) - fprintf(stdout,"\n AUTO_INCREMENT_FLAG"); + fprintf(stdout, "\n AUTO_INCREMENT_FLAG"); } mysql_free_result(result); } -/************************************************************** - * Test mysql_stmt_close for open stmts * -**************************************************************/ + +/* Test mysql_stmt_close for open stmts */ + static void test_stmt_close() { MYSQL *lmysql; @@ -4223,97 +4042,100 @@ static void test_stmt_close() MYSQL_RES *result; unsigned int count; int rc; - - myheader("test_stmt_close"); + + myheader("test_stmt_close"); fprintf(stdout, "\n Establishing a test connection ..."); - if (!(lmysql = mysql_init(NULL))) - { + if (!(lmysql= mysql_init(NULL))) + { myerror("mysql_init() failed"); exit(0); } - if (!(mysql_real_connect(lmysql,opt_host,opt_user, - opt_password, current_db, opt_port, - opt_unix_socket, 0))) + if (!(mysql_real_connect(lmysql, opt_host, opt_user, + opt_password, current_db, opt_port, + opt_unix_socket, 0))) { myerror("connection failed"); exit(0); - } - fprintf(stdout," OK"); - + } + fprintf(stdout, " OK"); + /* set AUTOCOMMIT to ON*/ mysql_autocommit(lmysql, TRUE); - - rc = mysql_query(lmysql,"DROP TABLE IF EXISTS test_stmt_close"); - myquery(rc); - - rc = mysql_query(lmysql,"CREATE TABLE test_stmt_close(id int)"); + + rc= mysql_query(lmysql, "DROP TABLE IF EXISTS test_stmt_close"); myquery(rc); - strmov(query,"DO \"nothing\""); + rc= mysql_query(lmysql, "CREATE TABLE test_stmt_close(id int)"); + myquery(rc); + + strmov(query, "DO \"nothing\""); stmt1= mysql_simple_prepare(lmysql, query); check_stmt(stmt1); - + verify_param_count(stmt1, 0); - - strmov(query,"INSERT INTO test_stmt_close(id) VALUES(?)"); + + strmov(query, "INSERT INTO test_stmt_close(id) VALUES(?)"); stmt_x= mysql_simple_prepare(mysql, query); check_stmt(stmt_x); verify_param_count(stmt_x, 1); - - strmov(query,"UPDATE test_stmt_close SET id=? WHERE id=?"); + + strmov(query, "UPDATE test_stmt_close SET id= ? WHERE id= ?"); stmt3= mysql_simple_prepare(lmysql, query); check_stmt(stmt3); - + verify_param_count(stmt3, 2); - - strmov(query,"SELECT * FROM test_stmt_close WHERE id=?"); + + strmov(query, "SELECT * FROM test_stmt_close WHERE id= ?"); stmt2= mysql_simple_prepare(lmysql, query); check_stmt(stmt2); verify_param_count(stmt2, 1); rc= mysql_stmt_close(stmt1); - fprintf(stdout,"\n mysql_close_stmt(1) returned: %d", rc); + fprintf(stdout, "\n mysql_close_stmt(1) returned: %d", rc); assert(rc == 0); - + /* Originally we were going to close all statements automatically in mysql_close(). This proved to not work well - users weren't able to close statements by hand once mysql_close() had been called. Now mysql_close() doesn't free any statements, so this test doesn't - serve its original destination any more. + serve its original designation any more. Here we free stmt2 and stmt3 by hande to avoid memory leaks. */ mysql_stmt_close(stmt2); mysql_stmt_close(stmt3); mysql_close(lmysql); - - count= 100; - bind[0].buffer=(char *)&count; - bind[0].buffer_type=MYSQL_TYPE_LONG; - bind[0].buffer_length= 0; - bind[0].length= 0; - bind[0].is_null=0; - rc = mysql_bind_param(stmt_x, bind); + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); + + bind[0].buffer= (char *)&count; + bind[0].buffer_type= MYSQL_TYPE_LONG; + count= 100; + + rc= mysql_stmt_bind_param(stmt_x, bind); check_execute(stmt_x, rc); - - rc = mysql_execute(stmt_x); + + rc= mysql_stmt_execute(stmt_x); check_execute(stmt_x, rc); verify_st_affected_rows(stmt_x, 1); rc= mysql_stmt_close(stmt_x); - fprintf(stdout,"\n mysql_close_stmt(x) returned: %d", rc); + fprintf(stdout, "\n mysql_close_stmt(x) returned: %d", rc); assert( rc == 0); - rc = mysql_query(mysql,"SELECT id FROM test_stmt_close"); + rc= mysql_query(mysql, "SELECT id FROM test_stmt_close"); myquery(rc); - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(1 == my_process_result_set(result)); @@ -4321,9 +4143,8 @@ static void test_stmt_close() } -/******************************************************** - * To test simple set-variable prepare * -*********************************************************/ +/* Test simple set-variable prepare */ + static void test_set_variable() { MYSQL_STMT *stmt, *stmt1; @@ -4336,13 +4157,18 @@ static void test_set_variable() myheader("test_set_variable"); mysql_autocommit(mysql, TRUE); - - stmt1 = mysql_simple_prepare(mysql, "show variables like 'max_error_count'"); + + stmt1= mysql_simple_prepare(mysql, "show variables like 'max_error_count'"); check_stmt(stmt1); + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) get_bind, sizeof(get_bind)); + get_bind[0].buffer_type= MYSQL_TYPE_STRING; get_bind[0].buffer= (char *)var; - get_bind[0].is_null= 0; get_bind[0].length= &length; get_bind[0].buffer_length= (int)NAME_LEN; length= NAME_LEN; @@ -4352,74 +4178,76 @@ static void test_set_variable() get_bind[1].is_null= 0; get_bind[1].length= 0; - rc = mysql_execute(stmt1); - check_execute(stmt1, rc); - - rc = mysql_bind_result(stmt1, get_bind); + rc= mysql_stmt_execute(stmt1); check_execute(stmt1, rc); - rc = mysql_fetch(stmt1); + rc= mysql_stmt_bind_result(stmt1, get_bind); + check_execute(stmt1, rc); + + rc= mysql_stmt_fetch(stmt1); check_execute(stmt1, rc); fprintf(stdout, "\n max_error_count(default): %d", get_count); def_count= get_count; - assert(strcmp(var,"max_error_count") == 0); - rc = mysql_fetch(stmt1); + assert(strcmp(var, "max_error_count") == 0); + rc= mysql_stmt_fetch(stmt1); assert(rc == MYSQL_NO_DATA); - stmt = mysql_simple_prepare(mysql, "set max_error_count=?"); + stmt= mysql_simple_prepare(mysql, "set max_error_count= ?"); check_stmt(stmt); + bzero((char*) set_bind, sizeof(set_bind)); + set_bind[0].buffer_type= MYSQL_TYPE_LONG; set_bind[0].buffer= (char *)&set_count; - set_bind[0].is_null= 0; - set_bind[0].length= 0; - - rc = mysql_bind_param(stmt, set_bind); - check_execute(stmt,rc); - + + rc= mysql_stmt_bind_param(stmt, set_bind); + check_execute(stmt, rc); + set_count= 31; - rc= mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); mysql_commit(mysql); - rc = mysql_execute(stmt1); + rc= mysql_stmt_execute(stmt1); check_execute(stmt1, rc); - - rc = mysql_fetch(stmt1); + + rc= mysql_stmt_fetch(stmt1); check_execute(stmt1, rc); fprintf(stdout, "\n max_error_count : %d", get_count); assert(get_count == set_count); - rc = mysql_fetch(stmt1); + rc= mysql_stmt_fetch(stmt1); assert(rc == MYSQL_NO_DATA); - + /* restore back to default */ set_count= def_count; - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - - rc = mysql_execute(stmt1); + + rc= mysql_stmt_execute(stmt1); check_execute(stmt1, rc); - - rc = mysql_fetch(stmt1); + + rc= mysql_stmt_fetch(stmt1); check_execute(stmt1, rc); fprintf(stdout, "\n max_error_count(default): %d", get_count); assert(get_count == set_count); - rc = mysql_fetch(stmt1); + rc= mysql_stmt_fetch(stmt1); assert(rc == MYSQL_NO_DATA); - + mysql_stmt_close(stmt); mysql_stmt_close(stmt1); } #if NOT_USED + /* Insert meta info .. */ + static void test_insert_meta() { MYSQL_STMT *stmt; @@ -4429,35 +4257,32 @@ static void test_insert_meta() myheader("test_insert_meta"); - rc = mysql_autocommit(mysql, TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prep_insert"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prep_insert"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_prep_insert(col1 tinyint,\ + rc= mysql_query(mysql, "CREATE TABLE test_prep_insert(col1 tinyint, \ col2 varchar(50), col3 varchar(30))"); myquery(rc); - strmov(query,"INSERT INTO test_prep_insert VALUES(10,'venu1','test')"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO test_prep_insert VALUES(10, 'venu1', 'test')"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,0); + verify_param_count(stmt, 0); result= mysql_param_result(stmt); mytest_r(result); mysql_stmt_close(stmt); - strmov(query,"INSERT INTO test_prep_insert VALUES(?,'venu',?)"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "INSERT INTO test_prep_insert VALUES(?, 'venu', ?)"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); result= mysql_param_result(stmt); mytest(result); @@ -4468,12 +4293,12 @@ static void test_insert_meta() field= mysql_fetch_field(result); mytest(field); fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col1"); - assert(strcmp(field->name,"col1")==0); + assert(strcmp(field->name, "col1") == 0); field= mysql_fetch_field(result); mytest(field); fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col3"); - assert(strcmp(field->name,"col3")==0); + assert(strcmp(field->name, "col3") == 0); field= mysql_fetch_field(result); mytest_r(field); @@ -4482,7 +4307,9 @@ static void test_insert_meta() mysql_stmt_close(stmt); } + /* Update meta info .. */ + static void test_update_meta() { MYSQL_STMT *stmt; @@ -4492,35 +4319,32 @@ static void test_update_meta() myheader("test_update_meta"); - rc = mysql_autocommit(mysql, TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prep_update"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prep_update"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_prep_update(col1 tinyint,\ + rc= mysql_query(mysql, "CREATE TABLE test_prep_update(col1 tinyint, \ col2 varchar(50), col3 varchar(30))"); myquery(rc); - strmov(query,"UPDATE test_prep_update SET col1=10, col2='venu1' WHERE col3='test'"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "UPDATE test_prep_update SET col1=10, col2='venu1' WHERE col3='test'"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,0); + verify_param_count(stmt, 0); result= mysql_param_result(stmt); mytest_r(result); mysql_stmt_close(stmt); - strmov(query,"UPDATE test_prep_update SET col1=?, col2='venu' WHERE col3=?"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "UPDATE test_prep_update SET col1=?, col2='venu' WHERE col3=?"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); result= mysql_param_result(stmt); mytest(result); @@ -4532,15 +4356,15 @@ static void test_update_meta() mytest(field); fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col1"); fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_update"); - assert(strcmp(field->name,"col1")==0); - assert(strcmp(field->table,"test_prep_update")==0); + assert(strcmp(field->name, "col1") == 0); + assert(strcmp(field->table, "test_prep_update") == 0); field= mysql_fetch_field(result); mytest(field); fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col3"); fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_update"); - assert(strcmp(field->name,"col3")==0); - assert(strcmp(field->table,"test_prep_update")==0); + assert(strcmp(field->name, "col3") == 0); + assert(strcmp(field->table, "test_prep_update") == 0); field= mysql_fetch_field(result); mytest_r(field); @@ -4549,7 +4373,9 @@ static void test_update_meta() mysql_stmt_close(stmt); } + /* Select meta info .. */ + static void test_select_meta() { MYSQL_STMT *stmt; @@ -4559,33 +4385,30 @@ static void test_select_meta() myheader("test_select_meta"); - rc = mysql_autocommit(mysql, TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prep_select"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prep_select"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_prep_select(col1 tinyint,\ + rc= mysql_query(mysql, "CREATE TABLE test_prep_select(col1 tinyint, \ col2 varchar(50), col3 varchar(30))"); myquery(rc); - strmov(query,"SELECT * FROM test_prep_select WHERE col1=10"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "SELECT * FROM test_prep_select WHERE col1=10"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,0); + verify_param_count(stmt, 0); result= mysql_param_result(stmt); mytest_r(result); - strmov(query,"SELECT col1, col3 from test_prep_select WHERE col1=? AND col3='test' AND col2= ?"); - stmt = mysql_simple_prepare(mysql, query); + strmov(query, "SELECT col1, col3 from test_prep_select WHERE col1=? AND col3='test' AND col2= ?"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - verify_param_count(stmt,2); + verify_param_count(stmt, 2); result= mysql_param_result(stmt); mytest(result); @@ -4597,15 +4420,15 @@ static void test_select_meta() mytest(field); fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col1"); fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_select"); - assert(strcmp(field->name,"col1")==0); - assert(strcmp(field->table,"test_prep_select")==0); + assert(strcmp(field->name, "col1") == 0); + assert(strcmp(field->table, "test_prep_select") == 0); field= mysql_fetch_field(result); mytest(field); fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col2"); fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_select"); - assert(strcmp(field->name,"col2")==0); - assert(strcmp(field->table,"test_prep_select")==0); + assert(strcmp(field->name, "col2") == 0); + assert(strcmp(field->table, "test_prep_select") == 0); field= mysql_fetch_field(result); mytest_r(field); @@ -4617,6 +4440,7 @@ static void test_select_meta() /* Test FUNCTION field info / DATE_FORMAT() table_name . */ + static void test_func_fields() { int rc; @@ -4625,71 +4449,68 @@ static void test_func_fields() myheader("test_func_fields"); - rc = mysql_autocommit(mysql, TRUE); + rc= mysql_autocommit(mysql, TRUE); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_dateformat"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_dateformat"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_dateformat(id int, \ + rc= mysql_query(mysql, "CREATE TABLE test_dateformat(id int, \ ts timestamp)"); myquery(rc); - rc = mysql_query(mysql, "INSERT INTO test_dateformat(id) values(10)"); + rc= mysql_query(mysql, "INSERT INTO test_dateformat(id) values(10)"); myquery(rc); - rc = mysql_query(mysql, "SELECT ts FROM test_dateformat"); + rc= mysql_query(mysql, "SELECT ts FROM test_dateformat"); myquery(rc); - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); - field = mysql_fetch_field(result); + field= mysql_fetch_field(result); mytest(field); - fprintf(stdout,"\n table name: `%s` (expected: `%s`)", field->table, + fprintf(stdout, "\n table name: `%s` (expected: `%s`)", field->table, "test_dateformat"); - assert(strcmp(field->table, "test_dateformat")==0); + assert(strcmp(field->table, "test_dateformat") == 0); - field = mysql_fetch_field(result); + field= mysql_fetch_field(result); mytest_r(field); /* no more fields */ mysql_free_result(result); /* DATE_FORMAT */ - rc = mysql_query(mysql, "SELECT DATE_FORMAT(ts,'%Y') AS 'venu' FROM test_dateformat"); + rc= mysql_query(mysql, "SELECT DATE_FORMAT(ts, '%Y') AS 'venu' FROM test_dateformat"); myquery(rc); - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); - field = mysql_fetch_field(result); + field= mysql_fetch_field(result); mytest(field); - fprintf(stdout,"\n table name: `%s` (expected: `%s`)", field->table, ""); + fprintf(stdout, "\n table name: `%s` (expected: `%s`)", field->table, ""); assert(field->table[0] == '\0'); - field = mysql_fetch_field(result); + field= mysql_fetch_field(result); mytest_r(field); /* no more fields */ mysql_free_result(result); /* FIELD ALIAS TEST */ - rc = mysql_query(mysql, "SELECT DATE_FORMAT(ts,'%Y') AS 'YEAR' FROM test_dateformat"); + rc= mysql_query(mysql, "SELECT DATE_FORMAT(ts, '%Y') AS 'YEAR' FROM test_dateformat"); myquery(rc); - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); - field = mysql_fetch_field(result); + field= mysql_fetch_field(result); mytest(field); - fprintf(stdout,"\n field name: `%s` (expected: `%s`)", field->name, "YEAR"); - fprintf(stdout,"\n field org name: `%s` (expected: `%s`)",field->org_name,""); - assert(strcmp(field->name, "YEAR")==0); + fprintf(stdout, "\n field name: `%s` (expected: `%s`)", field->name, "YEAR"); + fprintf(stdout, "\n field org name: `%s` (expected: `%s`)", field->org_name, ""); + assert(strcmp(field->name, "YEAR") == 0); assert(field->org_name[0] == '\0'); - field = mysql_fetch_field(result); + field= mysql_fetch_field(result); mytest_r(field); /* no more fields */ mysql_free_result(result); @@ -4697,6 +4518,7 @@ static void test_func_fields() /* Multiple stmts .. */ + static void test_multi_stmt() { @@ -4708,98 +4530,106 @@ static void test_multi_stmt() my_bool is_null[2]; myheader("test_multi_stmt"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_multi_table"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_multi_table"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_multi_table(id int, name char(20))"); + rc= mysql_query(mysql, "CREATE TABLE test_multi_table(id int, name char(20))"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_multi_table values(10,'mysql')"); + rc= mysql_query(mysql, "INSERT INTO test_multi_table values(10, 'mysql')"); myquery(rc); - stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_multi_table WHERE id = ?"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_multi_table " + "WHERE id= ?"); check_stmt(stmt); - stmt2 = mysql_simple_prepare(mysql, "UPDATE test_multi_table SET name='updated' WHERE id=10"); + stmt2= mysql_simple_prepare(mysql, "UPDATE test_multi_table " + "SET name='updated' WHERE id=10"); check_stmt(stmt2); - verify_param_count(stmt,1); + verify_param_count(stmt, 1); + + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); bind[0].buffer_type= MYSQL_TYPE_SHORT; bind[0].buffer= (char *)&id; bind[0].is_null= &is_null[0]; - bind[0].buffer_length= 0; bind[0].length= &length[0]; is_null[0]= 0; length[0]= 0; - bind[1].buffer_type = MYSQL_TYPE_STRING; - bind[1].buffer = (char *)name; + bind[1].buffer_type= MYSQL_TYPE_STRING; + bind[1].buffer= (char *)name; bind[1].buffer_length= sizeof(name); - bind[1].length = &length[1]; + bind[1].length= &length[1]; bind[1].is_null= &is_null[1]; - - rc = mysql_bind_param(stmt, bind); - check_execute(stmt, rc); - - rc = mysql_bind_result(stmt, bind); + + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - id = 10; - rc = mysql_execute(stmt); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - - id = 999; - rc = mysql_fetch(stmt); + + id= 10; + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + id= 999; + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); fprintf(stdout, "\n int_data: %d(%lu)", id, length[0]); fprintf(stdout, "\n str_data: %s(%lu)", name, length[1]); assert(id == 10); - assert(strcmp(name,"mysql")==0); + assert(strcmp(name, "mysql") == 0); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); /* alter the table schema now */ - stmt1 = mysql_simple_prepare(mysql,"DELETE FROM test_multi_table WHERE id = ? AND name=?"); + stmt1= mysql_simple_prepare(mysql, "DELETE FROM test_multi_table " + "WHERE id= ? AND name=?"); check_stmt(stmt1); - verify_param_count(stmt1,2); + verify_param_count(stmt1, 2); - rc = mysql_bind_param(stmt1, bind); + rc= mysql_stmt_bind_param(stmt1, bind); check_execute(stmt1, rc); - - rc = mysql_execute(stmt2); + + rc= mysql_stmt_execute(stmt2); check_execute(stmt2, rc); verify_st_affected_rows(stmt2, 1); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - - rc = mysql_fetch(stmt); + + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); fprintf(stdout, "\n int_data: %d(%lu)", id, length[0]); fprintf(stdout, "\n str_data: %s(%lu)", name, length[1]); assert(id == 10); - assert(strcmp(name,"updated")==0); + assert(strcmp(name, "updated") == 0); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); - rc = mysql_execute(stmt1); + rc= mysql_stmt_execute(stmt1); check_execute(stmt1, rc); verify_st_affected_rows(stmt1, 1); mysql_stmt_close(stmt1); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); assert(0 == my_stmt_result("SELECT * FROM test_multi_table")); @@ -4810,9 +4640,8 @@ static void test_multi_stmt() } -/******************************************************** -* to test simple sample - manual * -*********************************************************/ +/* Test simple sample - manual */ + static void test_manual_sample() { unsigned int param_count; @@ -4827,29 +4656,29 @@ static void test_manual_sample() myheader("test_manual_sample"); /* - Sample which is incorporated directly in the manual under Prepared - statements section (Example from mysql_execute() + Sample which is incorporated directly in the manual under Prepared + statements section (Example from mysql_stmt_execute() */ mysql_autocommit(mysql, 1); - if (mysql_query(mysql,"DROP TABLE IF EXISTS test_table")) + if (mysql_query(mysql, "DROP TABLE IF EXISTS test_table")) { fprintf(stderr, "\n drop table failed"); fprintf(stderr, "\n %s", mysql_error(mysql)); exit(0); } - if (mysql_query(mysql,"CREATE TABLE test_table(col1 int, col2 varchar(50), \ - col3 smallint,\ + if (mysql_query(mysql, "CREATE TABLE test_table(col1 int, col2 varchar(50), \ + col3 smallint, \ col4 timestamp(14))")) { fprintf(stderr, "\n create table failed"); fprintf(stderr, "\n %s", mysql_error(mysql)); exit(0); } - + /* Prepare a insert query with 3 parameters */ - strmov(query, "INSERT INTO test_table(col1,col2,col3) values(?,?,?)"); - if (!(stmt = mysql_simple_prepare(mysql,query))) + strmov(query, "INSERT INTO test_table(col1, col2, col3) values(?, ?, ?)"); + if (!(stmt= mysql_simple_prepare(mysql, query))) { fprintf(stderr, "\n prepare, insert failed"); fprintf(stderr, "\n %s", mysql_error(mysql)); @@ -4858,7 +4687,7 @@ static void test_manual_sample() fprintf(stdout, "\n prepare, insert successful"); /* Get the parameter count from the statement */ - param_count= mysql_param_count(stmt); + param_count= mysql_stmt_param_count(stmt); fprintf(stdout, "\n total parameters in insert: %d", param_count); if (param_count != 3) /* validate parameter count */ @@ -4869,28 +4698,29 @@ static void test_manual_sample() /* Bind the data for the parameters */ + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); + /* INTEGER PART */ bind[0].buffer_type= MYSQL_TYPE_LONG; bind[0].buffer= (char *)&int_data; - bind[0].is_null= 0; - bind[0].length= 0; /* STRING PART */ bind[1].buffer_type= MYSQL_TYPE_VAR_STRING; bind[1].buffer= (char *)str_data; bind[1].buffer_length= sizeof(str_data); - bind[1].is_null= 0; - bind[1].length= 0; - + /* SMALLINT PART */ bind[2].buffer_type= MYSQL_TYPE_SHORT; - bind[2].buffer= (char *)&small_data; + bind[2].buffer= (char *)&small_data; bind[2].is_null= &is_null; - bind[2].length= 0; is_null= 0; /* Bind the buffers */ - if (mysql_bind_param(stmt, bind)) + if (mysql_stmt_bind_param(stmt, bind)) { fprintf(stderr, "\n param bind failed"); fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); @@ -4899,20 +4729,20 @@ static void test_manual_sample() /* Specify the data */ int_data= 10; /* integer */ - strmov(str_data,"MySQL"); /* string */ - + strmov(str_data, "MySQL"); /* string */ + /* INSERT SMALLINT data as NULL */ is_null= 1; /* Execute the insert statement - 1*/ - if (mysql_execute(stmt)) + if (mysql_stmt_execute(stmt)) { fprintf(stderr, "\n execute 1 failed"); fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); exit(0); } - - /* Get the total rows affected */ + + /* Get the total rows affected */ affected_rows= mysql_stmt_affected_rows(stmt); fprintf(stdout, "\n total affected rows: %lld", affected_rows); @@ -4923,20 +4753,20 @@ static void test_manual_sample() } /* Re-execute the insert, by changing the values */ - int_data= 1000; - strmov(str_data,"The most popular open source database"); + int_data= 1000; + strmov(str_data, "The most popular open source database"); small_data= 1000; /* smallint */ is_null= 0; /* reset */ /* Execute the insert statement - 2*/ - if (mysql_execute(stmt)) + if (mysql_stmt_execute(stmt)) { fprintf(stderr, "\n execute 2 failed"); fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); exit(0); } - - /* Get the total rows affected */ + + /* Get the total rows affected */ affected_rows= mysql_stmt_affected_rows(stmt); fprintf(stdout, "\n total affected rows: %lld", affected_rows); @@ -4956,7 +4786,7 @@ static void test_manual_sample() assert(2 == my_stmt_result("SELECT * FROM test_table")); /* DROP THE TABLE */ - if (mysql_query(mysql,"DROP TABLE test_table")) + if (mysql_query(mysql, "DROP TABLE test_table")) { fprintf(stderr, "\n drop table failed"); fprintf(stderr, "\n %s", mysql_error(mysql)); @@ -4966,9 +4796,8 @@ static void test_manual_sample() } -/******************************************************** -* to test alter table scenario in the middle of prepare * -*********************************************************/ +/* Test alter table scenario in the middle of prepare */ + static void test_prepare_alter() { MYSQL_STMT *stmt; @@ -4979,39 +4808,44 @@ static void test_prepare_alter() myheader("test_prepare_alter"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prep_alter"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prep_alter"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_prep_alter(id int, name char(20))"); + rc= mysql_query(mysql, "CREATE TABLE test_prep_alter(id int, name char(20))"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_prep_alter values(10,'venu'),(20,'mysql')"); + rc= mysql_query(mysql, "INSERT INTO test_prep_alter values(10, 'venu'), (20, 'mysql')"); myquery(rc); - stmt = mysql_simple_prepare(mysql, "INSERT INTO test_prep_alter VALUES(?,'monty')"); + stmt= mysql_simple_prepare(mysql, "INSERT INTO test_prep_alter VALUES(?, 'monty')"); check_stmt(stmt); - verify_param_count(stmt,1); + verify_param_count(stmt, 1); + + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); is_null= 0; bind[0].buffer_type= MYSQL_TYPE_SHORT; bind[0].buffer= (char *)&id; - bind[0].buffer_length= 0; - bind[0].length= 0; bind[0].is_null= &is_null; - rc = mysql_bind_param(stmt, bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - - id = 30; length= 0; - rc = mysql_execute(stmt); + + id= 30; + length= 0; + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); if (thread_query((char *)"ALTER TABLE test_prep_alter change id id_new varchar(20)")) exit(0); - is_null=1; - rc = mysql_execute(stmt); + is_null= 1; + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(4 == my_stmt_result("SELECT * FROM test_prep_alter")); @@ -5019,9 +4853,8 @@ static void test_prepare_alter() mysql_stmt_close(stmt); } -/******************************************************** -* to test the support of multi-statement executions * -*********************************************************/ + +/* Test the support of multi-statement executions */ static void test_multi_statements() { @@ -5029,11 +4862,11 @@ static void test_multi_statements() MYSQL_RES *result; int rc; - const char *query="\ + const char *query= "\ DROP TABLE IF EXISTS test_multi_tab;\ -CREATE TABLE test_multi_tab(id int,name char(20));\ -INSERT INTO test_multi_tab(id) VALUES(10),(20);\ -INSERT INTO test_multi_tab VALUES(20,'insert;comma');\ +CREATE TABLE test_multi_tab(id int, name char(20));\ +INSERT INTO test_multi_tab(id) VALUES(10), (20);\ +INSERT INTO test_multi_tab VALUES(20, 'insert;comma');\ SELECT * FROM test_multi_tab;\ UPDATE test_multi_tab SET name='new;name' WHERE id=20;\ DELETE FROM test_multi_tab WHERE name='new;name';\ @@ -5052,64 +4885,64 @@ DROP TABLE IF EXISTS test_multi_tab"; First test that we get an error for multi statements (Becasue default connection is not opened with CLIENT_MULTI_STATEMENTS) */ - rc = mysql_query(mysql, query); /* syntax error */ + rc= mysql_query(mysql, query); /* syntax error */ myquery_r(rc); assert(-1 == mysql_next_result(mysql)); assert(0 == mysql_more_results(mysql)); - if (!(mysql_local = mysql_init(NULL))) - { - fprintf(stdout,"\n mysql_init() failed"); + if (!(mysql_local= mysql_init(NULL))) + { + fprintf(stdout, "\n mysql_init() failed"); exit(1); } /* Create connection that supprot multi statements */ - if (!(mysql_real_connect(mysql_local,opt_host,opt_user, - opt_password, current_db, opt_port, - opt_unix_socket, CLIENT_MULTI_STATEMENTS))) + if (!(mysql_real_connect(mysql_local, opt_host, opt_user, + opt_password, current_db, opt_port, + opt_unix_socket, CLIENT_MULTI_STATEMENTS))) { - fprintf(stdout,"\n connection failed(%s)", mysql_error(mysql_local)); + fprintf(stdout, "\n connection failed(%s)", mysql_error(mysql_local)); exit(1); } - rc = mysql_query(mysql_local, query); + rc= mysql_query(mysql_local, query); myquery(rc); - for (count=0 ; count < array_elements(rows) ; count++) + for (count= 0 ; count < array_elements(rows) ; count++) { - fprintf(stdout,"\n Query %d: ", count); + fprintf(stdout, "\n Query %d: ", count); if ((result= mysql_store_result(mysql_local))) { my_process_result_set(result); mysql_free_result(result); } else - fprintf(stdout,"OK, %lld row(s) affected, %d warning(s)\n", - mysql_affected_rows(mysql_local), - mysql_warning_count(mysql_local)); + fprintf(stdout, "OK, %lld row(s) affected, %d warning(s)\n", + mysql_affected_rows(mysql_local), + mysql_warning_count(mysql_local)); exp_value= (uint) mysql_affected_rows(mysql_local); if (rows[count] != exp_value) { fprintf(stdout, "row %d had affected rows: %d, should be %d\n", - count, exp_value, rows[count]); + count, exp_value, rows[count]); exit(1); } if (count != array_elements(rows) -1) { if (!(rc= mysql_more_results(mysql_local))) { - fprintf(stdout, - "mysql_more_result returned wrong value: %d for row %d\n", - rc, count); - exit(1); + fprintf(stdout, + "mysql_more_result returned wrong value: %d for row %d\n", + rc, count); + exit(1); } if ((rc= mysql_next_result(mysql_local))) { - exp_value= mysql_errno(mysql_local); + exp_value= mysql_errno(mysql_local); - exit(1); + exit(1); } } else @@ -5148,38 +4981,40 @@ DROP TABLE IF EXISTS test_multi_tab"; mysql_close(mysql_local); } -/******************************************************** -* Check that Prepared statement cannot contain several * -* SQL statements * -*********************************************************/ + +/* + Check that Prepared statement cannot contain several + SQL statements +*/ + static void test_prepare_multi_statements() { MYSQL *mysql_local; MYSQL_STMT *stmt; myheader("test_prepare_multi_statements"); - if (!(mysql_local = mysql_init(NULL))) - { - fprintf(stdout,"\n mysql_init() failed"); + if (!(mysql_local= mysql_init(NULL))) + { + fprintf(stdout, "\n mysql_init() failed"); exit(1); } - if (!(mysql_real_connect(mysql_local,opt_host,opt_user, + if (!(mysql_real_connect(mysql_local, opt_host, opt_user, opt_password, current_db, opt_port, opt_unix_socket, CLIENT_MULTI_STATEMENTS))) { - fprintf(stdout,"\n connection failed(%s)", mysql_error(mysql_local)); + fprintf(stdout, "\n connection failed(%s)", mysql_error(mysql_local)); exit(1); } strmov(query, "select 1; select 'another value'"); - stmt = mysql_simple_prepare(mysql_local,query); + stmt= mysql_simple_prepare(mysql_local, query); check_stmt_r(stmt); mysql_close(mysql_local); } -/******************************************************** -* to test simple bind store result * -*********************************************************/ + +/* Test simple bind store result */ + static void test_store_result() { MYSQL_STMT *stmt; @@ -5187,129 +5022,122 @@ static void test_store_result() long nData; char szData[100]; MYSQL_BIND bind[2]; - ulong length, length1; + ulong length, length1; my_bool is_null[2]; myheader("test_store_result"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_store_result"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_store_result"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_store_result(col1 int , col2 varchar(50))"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_store_result(col1 int ,col2 varchar(50))"); + rc= mysql_query(mysql, "INSERT INTO test_store_result VALUES(10, 'venu'), (20, 'mysql')"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "INSERT INTO test_store_result(col2) VALUES('monty')"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_store_result VALUES(10,'venu'),(20,'mysql')"); - myquery(rc); - - rc = mysql_query(mysql,"INSERT INTO test_store_result(col2) VALUES('monty')"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* fetch */ - bind[0].buffer_type=FIELD_TYPE_LONG; - bind[0].buffer= (char*) &nData; /* integer data */ + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (char*) &nData; /* integer data */ bind[0].length= &length; bind[0].is_null= &is_null[0]; - length= 0; - bind[1].buffer_type=FIELD_TYPE_STRING; - bind[1].buffer=szData; /* string data */ - bind[1].buffer_length=sizeof(szData); + length= 0; + bind[1].buffer_type= MYSQL_TYPE_STRING; + bind[1].buffer= szData; /* string data */ + bind[1].buffer_length= sizeof(szData); bind[1].length= &length1; bind[1].is_null= &is_null[1]; length1= 0; - stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_store_result"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_store_result"); check_stmt(stmt); - rc = mysql_bind_result(stmt,bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_stmt_store_result(stmt); + rc= mysql_stmt_store_result(stmt); check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout,"\n row 1: %ld,%s(%lu)", nData, szData, length1); + fprintf(stdout, "\n row 1: %ld, %s(%lu)", nData, szData, length1); assert(nData == 10); - assert(strcmp(szData,"venu")==0); + assert(strcmp(szData, "venu") == 0); assert(length1 == 4); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout,"\n row 2: %ld,%s(%lu)",nData, szData, length1); + fprintf(stdout, "\n row 2: %ld, %s(%lu)", nData, szData, length1); assert(nData == 20); - assert(strcmp(szData,"mysql")==0); + assert(strcmp(szData, "mysql") == 0); assert(length1 == 5); - length=99; - rc = mysql_fetch(stmt); - check_execute(stmt,rc); - + length= 99; + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); + if (is_null[0]) - fprintf(stdout,"\n row 3: NULL,%s(%lu)", szData, length1); + fprintf(stdout, "\n row 3: NULL, %s(%lu)", szData, length1); assert(is_null[0]); - assert(strcmp(szData,"monty")==0); + assert(strcmp(szData, "monty") == 0); assert(length1 == 5); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); - - rc = mysql_execute(stmt); + + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_stmt_store_result(stmt); + rc= mysql_stmt_store_result(stmt); check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout,"\n row 1: %ld,%s(%lu)",nData, szData, length1); + fprintf(stdout, "\n row 1: %ld, %s(%lu)", nData, szData, length1); assert(nData == 10); - assert(strcmp(szData,"venu")==0); + assert(strcmp(szData, "venu") == 0); assert(length1 == 4); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout,"\n row 2: %ld,%s(%lu)",nData, szData, length1); + fprintf(stdout, "\n row 2: %ld, %s(%lu)", nData, szData, length1); assert(nData == 20); - assert(strcmp(szData,"mysql")==0); + assert(strcmp(szData, "mysql") == 0); assert(length1 == 5); - length=99; - rc = mysql_fetch(stmt); - check_execute(stmt,rc); - + length= 99; + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); + if (is_null[0]) - fprintf(stdout,"\n row 3: NULL,%s(%lu)", szData, length1); + fprintf(stdout, "\n row 3: NULL, %s(%lu)", szData, length1); assert(is_null[0]); - assert(strcmp(szData,"monty")==0); + assert(strcmp(szData, "monty") == 0); assert(length1 == 5); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } -/******************************************************** -* to test simple bind store result * -*********************************************************/ +/* Test simple bind store result */ + static void test_store_result1() { MYSQL_STMT *stmt; @@ -5317,50 +5145,44 @@ static void test_store_result1() myheader("test_store_result1"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_store_result"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_store_result"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_store_result(col1 int , col2 varchar(50))"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_store_result(col1 int ,col2 varchar(50))"); + rc= mysql_query(mysql, "INSERT INTO test_store_result VALUES(10, 'venu'), (20, 'mysql')"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "INSERT INTO test_store_result(col2) VALUES('monty')"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_store_result VALUES(10,'venu'),(20,'mysql')"); + rc= mysql_commit(mysql); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_store_result(col2) VALUES('monty')"); - myquery(rc); - - rc = mysql_commit(mysql); - myquery(rc); - - stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_store_result"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_store_result"); check_stmt(stmt); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_stmt_store_result(stmt); + rc= mysql_stmt_store_result(stmt); check_execute(stmt, rc); - rc = 0; - while (mysql_fetch(stmt) != MYSQL_NO_DATA) + rc= 0; + while (mysql_stmt_fetch(stmt) != MYSQL_NO_DATA) rc++; fprintf(stdout, "\n total rows: %d", rc); assert(rc == 3); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_stmt_store_result(stmt); + rc= mysql_stmt_store_result(stmt); check_execute(stmt, rc); - rc = 0; - while (mysql_fetch(stmt) != MYSQL_NO_DATA) + rc= 0; + while (mysql_stmt_fetch(stmt) != MYSQL_NO_DATA) rc++; fprintf(stdout, "\n total rows: %d", rc); assert(rc == 3); @@ -5369,9 +5191,8 @@ static void test_store_result1() } -/******************************************************** -* to test simple bind store result * -*********************************************************/ +/* Another test for bind and store result */ + static void test_store_result2() { MYSQL_STMT *stmt; @@ -5382,85 +5203,83 @@ static void test_store_result2() myheader("test_store_result2"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_store_result"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_store_result"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_store_result(col1 int , col2 varchar(50))"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_store_result(col1 int ,col2 varchar(50))"); + rc= mysql_query(mysql, "INSERT INTO test_store_result VALUES(10, 'venu'), (20, 'mysql')"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "INSERT INTO test_store_result(col2) VALUES('monty')"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_store_result VALUES(10,'venu'),(20,'mysql')"); + rc= mysql_commit(mysql); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_store_result(col2) VALUES('monty')"); - myquery(rc); + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); - rc = mysql_commit(mysql); - myquery(rc); - - bind[0].buffer_type=FIELD_TYPE_LONG; - bind[0].buffer= (char *) &nData; /* integer data */ + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (char *) &nData; /* integer data */ bind[0].length= &length; bind[0].is_null= 0; strmov((char *)query , "SELECT col1 FROM test_store_result where col1= ?"); - stmt = mysql_simple_prepare(mysql, query); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_bind_result(stmt,bind); - check_execute(stmt, rc); - - nData = 10; length= 0; - rc = mysql_execute(stmt); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - nData = 0; - rc = mysql_stmt_store_result(stmt); + nData= 10; length= 0; + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + nData= 0; + rc= mysql_stmt_store_result(stmt); + check_execute(stmt, rc); - fprintf(stdout,"\n row 1: %d",nData); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); + + fprintf(stdout, "\n row 1: %d", nData); assert(nData == 10); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); - nData = 20; - rc = mysql_execute(stmt); + nData= 20; + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - nData = 0; - rc = mysql_stmt_store_result(stmt); + nData= 0; + rc= mysql_stmt_store_result(stmt); check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout,"\n row 1: %d",nData); + fprintf(stdout, "\n row 1: %d", nData); assert(nData == 20); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } -/******************************************************** -* to test simple subselect prepare * -*********************************************************/ +/* Test simple subselect prepare */ + static void test_subselect() { -#if TO_BE_FIXED_IN_SERVER MYSQL_STMT *stmt; int rc, id; @@ -5468,56 +5287,56 @@ static void test_subselect() myheader("test_subselect"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_sub1"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_sub1"); myquery(rc); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_sub2"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_sub2"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_sub1(id int)"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_sub1(id int)"); + rc= mysql_query(mysql, "CREATE TABLE test_sub2(id int, id1 int)"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_sub2(id int, id1 int)"); + rc= mysql_query(mysql, "INSERT INTO test_sub1 values(2)"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "INSERT INTO test_sub2 VALUES(1, 7), (2, 7)"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_sub1 values(2)"); - myquery(rc); - - rc = mysql_query(mysql,"INSERT INTO test_sub2 VALUES(1,7),(2,7)"); - myquery(rc); - - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); /* fetch */ - bind[0].buffer_type= FIELD_TYPE_LONG; - bind[0].buffer= (char *) &id; + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); + + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (char *) &id; bind[0].length= 0; bind[0].is_null= 0; - stmt = mysql_simple_prepare(mysql, "INSERT INTO test_sub2(id) SELECT * FROM test_sub1 WHERE id=?", 100); + stmt= mysql_simple_prepare(mysql, "INSERT INTO test_sub2(id) SELECT * FROM test_sub1 WHERE id= ?"); check_stmt(stmt); - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_bind_result(stmt,bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - id = 2; - rc = mysql_execute(stmt); + id= 2; + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); verify_st_affected_rows(stmt, 1); - id = 9; - rc = mysql_execute(stmt); + id= 9; + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); verify_st_affected_rows(stmt, 0); @@ -5526,101 +5345,108 @@ static void test_subselect() assert(3 == my_stmt_result("SELECT * FROM test_sub2")); - strmov((char *)query , "SELECT ROW(1,7) IN (select id, id1 from test_sub2 WHERE id1=?)"); - assert(1 == my_stmt_result("SELECT ROW(1,7) IN (select id, id1 from test_sub2 WHERE id1=8)")); - assert(1 == my_stmt_result("SELECT ROW(1,7) IN (select id, id1 from test_sub2 WHERE id1=7)")); + strmov((char *)query , "SELECT ROW(1, 7) IN (select id, id1 from test_sub2 WHERE id1= ?)"); + assert(1 == my_stmt_result("SELECT ROW(1, 7) IN (select id, id1 from test_sub2 WHERE id1= 8)")); + assert(1 == my_stmt_result("SELECT ROW(1, 7) IN (select id, id1 from test_sub2 WHERE id1= 7)")); - stmt = mysql_simple_prepare(mysql, query, 150); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - rc = mysql_bind_param(stmt,bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_bind_result(stmt,bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - id = 7; - rc = mysql_execute(stmt); + id= 7; + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout,"\n row 1: %d",id); + fprintf(stdout, "\n row 1: %d", id); assert(id == 1); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); - + id= 8; - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout,"\n row 1: %d",id); + fprintf(stdout, "\n row 1: %d", id); assert(id == 0); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); -#endif } + /* Generalized conversion routine to handle DATE, TIME and DATETIME conversion using MYSQL_TIME structure */ + static void test_bind_date_conv(uint row_count) -{ +{ MYSQL_STMT *stmt= 0; uint rc, i, count= row_count; - ulong length[4]; + ulong length[4]; MYSQL_BIND bind[4]; - my_bool is_null[4]={0}; - MYSQL_TIME tm[4]; + my_bool is_null[4]= {0}; + MYSQL_TIME tm[4]; ulong second_part; uint year, month, day, hour, minute, sec; - stmt = mysql_simple_prepare(mysql,"INSERT INTO test_date VALUES(?,?,?,?)"); + stmt= mysql_simple_prepare(mysql, "INSERT INTO test_date VALUES(?, ?, ?, ?)"); check_stmt(stmt); - verify_param_count(stmt, 4); + verify_param_count(stmt, 4); + + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); bind[0].buffer_type= MYSQL_TYPE_TIMESTAMP; bind[1].buffer_type= MYSQL_TYPE_TIME; bind[2].buffer_type= MYSQL_TYPE_DATETIME; bind[3].buffer_type= MYSQL_TYPE_DATE; - - second_part= 0; - - year=2000; - month=01; - day=10; - - hour=11; - minute=16; - sec= 20; for (i= 0; i < (int) array_elements(bind); i++) - { + { bind[i].buffer= (char *) &tm[i]; bind[i].is_null= &is_null[i]; bind[i].length= &length[i]; bind[i].buffer_length= 30; - length[i]=20; - } + length[i]= 20; + } + + second_part= 0; + + year= 2000; + month= 01; + day= 10; + + hour= 11; + minute= 16; + sec= 20; + + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); - rc = mysql_bind_param(stmt, bind); - check_execute(stmt,rc); - for (count= 0; count < row_count; count++) - { + { for (i= 0; i < (int) array_elements(bind); i++) { - tm[i].neg= 0; + tm[i].neg= 0; tm[i].second_part= second_part+count; if (bind[i].buffer_type != MYSQL_TYPE_TIME) { @@ -5637,51 +5463,51 @@ static void test_bind_date_conv(uint row_count) tm[i].second= sec+count; } else - tm[i].hour= tm[i].minute= tm[i].second = 0; - } - rc = mysql_execute(stmt); - check_execute(stmt, rc); + tm[i].hour= tm[i].minute= tm[i].second= 0; + } + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); } - rc = mysql_commit(mysql); + rc= mysql_commit(mysql); myquery(rc); mysql_stmt_close(stmt); assert(row_count == my_stmt_result("SELECT * FROM test_date")); - stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_date"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_date"); myquery(rc); - rc = mysql_bind_result(stmt, bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_stmt_store_result(stmt); + rc= mysql_stmt_store_result(stmt); check_execute(stmt, rc); - for (count=0; count < row_count; count++) + for (count= 0; count < row_count; count++) { - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); fprintf(stdout, "\n"); for (i= 0; i < array_elements(bind); i++) - { + { fprintf(stdout, "\n"); - fprintf(stdout," time[%d]: %02d-%02d-%02d %02d:%02d:%02d.%02lu", - i, tm[i].year, tm[i].month, tm[i].day, + fprintf(stdout, " time[%d]: %02d-%02d-%02d %02d:%02d:%02d.%02lu", + i, tm[i].year, tm[i].month, tm[i].day, tm[i].hour, tm[i].minute, tm[i].second, - tm[i].second_part); + tm[i].second_part); assert(tm[i].year == 0 || tm[i].year == year+count); assert(tm[i].month == 0 || tm[i].month == month+count); assert(tm[i].day == 0 || tm[i].day == day+count); assert(tm[i].hour == 0 || tm[i].hour == hour+count); - /* + /* minute causes problems from date<->time, don't assert, instead validate separatly in another routine */ @@ -5691,15 +5517,14 @@ static void test_bind_date_conv(uint row_count) assert(tm[i].second_part == 0 || tm[i].second_part == second_part+count); } } - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } -/* - Test DATE, TIME, DATETIME and TS with MYSQL_TIME conversion -*/ + +/* Test DATE, TIME, DATETIME and TS with MYSQL_TIME conversion */ static void test_date() { @@ -5707,25 +5532,21 @@ static void test_date() myheader("test_date"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_date"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_date"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_date(c1 TIMESTAMP(14), \ - c2 TIME,\ - c3 DATETIME,\ + + rc= mysql_query(mysql, "CREATE TABLE test_date(c1 TIMESTAMP(14), \ + c2 TIME, \ + c3 DATETIME, \ c4 DATE)"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - test_bind_date_conv(5); } -/* - Test all time types to DATE and DATE to all types -*/ + +/* Test all time types to DATE and DATE to all types */ static void test_date_date() { @@ -5733,25 +5554,21 @@ static void test_date_date() myheader("test_date_date"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_date"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_date"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_date(c1 DATE, \ - c2 DATE,\ - c3 DATE,\ + + rc= mysql_query(mysql, "CREATE TABLE test_date(c1 DATE, \ + c2 DATE, \ + c3 DATE, \ c4 DATE)"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - test_bind_date_conv(3); } -/* - Test all time types to TIME and TIME to all types -*/ + +/* Test all time types to TIME and TIME to all types */ static void test_date_time() { @@ -5759,25 +5576,21 @@ static void test_date_time() myheader("test_date_time"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_date"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_date"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_date(c1 TIME, \ - c2 TIME,\ - c3 TIME,\ + + rc= mysql_query(mysql, "CREATE TABLE test_date(c1 TIME, \ + c2 TIME, \ + c3 TIME, \ c4 TIME)"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - test_bind_date_conv(3); } -/* - Test all time types to TIMESTAMP and TIMESTAMP to all types -*/ + +/* Test all time types to TIMESTAMP and TIMESTAMP to all types */ static void test_date_ts() { @@ -5785,129 +5598,123 @@ static void test_date_ts() myheader("test_date_ts"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_date"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_date"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_date(c1 TIMESTAMP(10), \ - c2 TIMESTAMP(14),\ - c3 TIMESTAMP,\ + + rc= mysql_query(mysql, "CREATE TABLE test_date(c1 TIMESTAMP(10), \ + c2 TIMESTAMP(14), \ + c3 TIMESTAMP, \ c4 TIMESTAMP(6))"); myquery(rc); - rc = mysql_commit(mysql); - myquery(rc); - test_bind_date_conv(2); } -/* - Test all time types to DATETIME and DATETIME to all types -*/ + +/* Test all time types to DATETIME and DATETIME to all types */ static void test_date_dt() { - int rc; + int rc; myheader("test_date_dt"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_date"); - myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_date(c1 datetime, \ - c2 datetime,\ - c3 datetime,\ - c4 date)"); - + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_date"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_date(c1 datetime, " + " c2 datetime, c3 datetime, c4 date)"); myquery(rc); test_bind_date_conv(2); } -/* - Misc tests to keep pure coverage happy -*/ + +/* Misc tests to keep pure coverage happy */ + static void test_pure_coverage() { MYSQL_STMT *stmt; MYSQL_BIND bind[1]; int rc; ulong length; - + myheader("test_pure_coverage"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_pure"); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_pure(c1 int, c2 varchar(20))"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_pure"); myquery(rc); - stmt = mysql_simple_prepare(mysql,"insert into test_pure(c67788) values(10)"); + rc= mysql_query(mysql, "CREATE TABLE test_pure(c1 int, c2 varchar(20))"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "insert into test_pure(c67788) values(10)"); check_stmt_r(stmt); - + /* Query without params and result should allow to bind 0 arrays */ - stmt = mysql_simple_prepare(mysql,"insert into test_pure(c2) values(10)"); + stmt= mysql_simple_prepare(mysql, "insert into test_pure(c2) values(10)"); check_stmt(stmt); - - rc = mysql_bind_param(stmt, (MYSQL_BIND*)0); - check_execute(stmt, rc); - - rc = mysql_execute(stmt); + + rc= mysql_stmt_bind_param(stmt, (MYSQL_BIND*)0); check_execute(stmt, rc); - rc = mysql_bind_result(stmt, (MYSQL_BIND*)0); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - + + rc= mysql_stmt_bind_result(stmt, (MYSQL_BIND*)0); + check_execute(stmt, rc); + mysql_stmt_close(stmt); - stmt = mysql_simple_prepare(mysql,"insert into test_pure(c2) values(?)"); + stmt= mysql_simple_prepare(mysql, "insert into test_pure(c2) values(?)"); check_stmt(stmt); + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); + bind[0].length= &length; bind[0].is_null= 0; bind[0].buffer_length= 0; bind[0].buffer_type= MYSQL_TYPE_GEOMETRY; - rc = mysql_bind_param(stmt, bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute_r(stmt, rc); /* unsupported buffer type */ - + bind[0].buffer_type= MYSQL_TYPE_STRING; - rc = mysql_bind_param(stmt, bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_stmt_store_result(stmt); - check_execute(stmt, rc); + rc= mysql_stmt_store_result(stmt); + check_execute(stmt, rc); mysql_stmt_close(stmt); - stmt = mysql_simple_prepare(mysql,"select * from test_pure"); + stmt= mysql_simple_prepare(mysql, "select * from test_pure"); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); bind[0].buffer_type= MYSQL_TYPE_GEOMETRY; - rc = mysql_bind_result(stmt, bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute_r(stmt, rc); /* unsupported buffer type */ - rc = mysql_stmt_store_result(stmt); + rc= mysql_stmt_store_result(stmt); check_execute(stmt, rc); - - rc = mysql_stmt_store_result(stmt); + + rc= mysql_stmt_store_result(stmt); check_execute_r(stmt, rc); /* commands out of sync */ mysql_stmt_close(stmt); - mysql_query(mysql,"DROP TABLE test_pure"); - mysql_commit(mysql); + mysql_query(mysql, "DROP TABLE test_pure"); } -/* - test for string buffer fetch -*/ + +/* Test for string buffer fetch */ static void test_buffers() { @@ -5917,132 +5724,132 @@ static void test_buffers() ulong length; my_bool is_null; char buffer[20]; - + myheader("test_buffers"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_buffer"); - myquery(rc); - - rc = mysql_query(mysql,"CREATE TABLE test_buffer(str varchar(20))"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_buffer"); myquery(rc); - rc = mysql_query(mysql,"insert into test_buffer values('MySQL')\ - ,('Database'),('Open-Source'),('Popular')"); + rc= mysql_query(mysql, "CREATE TABLE test_buffer(str varchar(20))"); myquery(rc); - - stmt = mysql_simple_prepare(mysql,"select str from test_buffer"); + + rc= mysql_query(mysql, "insert into test_buffer values('MySQL')\ + , ('Database'), ('Open-Source'), ('Popular')"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "select str from test_buffer"); check_stmt(stmt); - - rc = mysql_execute(stmt); + + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - bzero(buffer, 20); /* Avoid overruns in printf() */ + bzero(buffer, 20); /* Avoid overruns in printf() */ bind[0].length= &length; bind[0].is_null= &is_null; bind[0].buffer_length= 1; bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].buffer= (char *)buffer; - - rc = mysql_bind_result(stmt, bind); + + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_stmt_store_result(stmt); + rc= mysql_stmt_store_result(stmt); check_execute(stmt, rc); - buffer[1]='X'; - rc = mysql_fetch(stmt); + buffer[1]= 'X'; + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); fprintf(stdout, "\n data: %s (%lu)", buffer, length); assert(buffer[0] == 'M'); assert(buffer[1] == 'X'); assert(length == 5); - bind[0].buffer_length=8; - rc = mysql_bind_result(stmt, bind);/* re-bind */ + bind[0].buffer_length= 8; + rc= mysql_stmt_bind_result(stmt, bind);/* re-bind */ check_execute(stmt, rc); - - rc = mysql_fetch(stmt); + + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); fprintf(stdout, "\n data: %s (%lu)", buffer, length); - assert(strncmp(buffer,"Database",8) == 0); + assert(strncmp(buffer, "Database", 8) == 0); assert(length == 8); - - bind[0].buffer_length=12; - rc = mysql_bind_result(stmt, bind);/* re-bind */ + + bind[0].buffer_length= 12; + rc= mysql_stmt_bind_result(stmt, bind);/* re-bind */ check_execute(stmt, rc); - - rc = mysql_fetch(stmt); + + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); fprintf(stdout, "\n data: %s (%lu)", buffer, length); - assert(strcmp(buffer,"Open-Source") == 0); + assert(strcmp(buffer, "Open-Source") == 0); assert(length == 11); - - bind[0].buffer_length=6; - rc = mysql_bind_result(stmt, bind);/* re-bind */ + + bind[0].buffer_length= 6; + rc= mysql_stmt_bind_result(stmt, bind);/* re-bind */ check_execute(stmt, rc); - - rc = mysql_fetch(stmt); + + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); fprintf(stdout, "\n data: %s (%lu)", buffer, length); - assert(strncmp(buffer,"Popula",6) == 0); + assert(strncmp(buffer, "Popula", 6) == 0); assert(length == 7); - + mysql_stmt_close(stmt); } -/* - Test the direct query execution in the middle of open stmts -*/ + +/* Test the direct query execution in the middle of open stmts */ + static void test_open_direct() { MYSQL_STMT *stmt; MYSQL_RES *result; int rc; - + myheader("test_open_direct"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_open_direct"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_open_direct"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_open_direct(id int, name char(6))"); + rc= mysql_query(mysql, "CREATE TABLE test_open_direct(id int, name char(6))"); myquery(rc); - stmt = mysql_simple_prepare(mysql,"INSERT INTO test_open_direct values(10,'mysql')"); + stmt= mysql_simple_prepare(mysql, "INSERT INTO test_open_direct values(10, 'mysql')"); check_stmt(stmt); - rc = mysql_query(mysql, "SELECT * FROM test_open_direct"); + rc= mysql_query(mysql, "SELECT * FROM test_open_direct"); myquery(rc); - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(0 == my_process_result_set(result)); mysql_free_result(result); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); verify_st_affected_rows(stmt, 1); - - rc = mysql_query(mysql, "SELECT * FROM test_open_direct"); + + rc= mysql_query(mysql, "SELECT * FROM test_open_direct"); myquery(rc); - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(1 == my_process_result_set(result)); mysql_free_result(result); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); verify_st_affected_rows(stmt, 1); - - rc = mysql_query(mysql, "SELECT * FROM test_open_direct"); + + rc= mysql_query(mysql, "SELECT * FROM test_open_direct"); myquery(rc); - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(2 == my_process_result_set(result)); @@ -6051,47 +5858,47 @@ static void test_open_direct() mysql_stmt_close(stmt); /* run a direct query in the middle of a fetch */ - stmt= mysql_simple_prepare(mysql,"SELECT * FROM test_open_direct"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_open_direct"); check_stmt(stmt); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - rc = mysql_query(mysql,"INSERT INTO test_open_direct(id) VALUES(20)"); + rc= mysql_query(mysql, "INSERT INTO test_open_direct(id) VALUES(20)"); myquery_r(rc); - rc = mysql_stmt_close(stmt); + rc= mysql_stmt_close(stmt); check_execute(stmt, rc); - rc = mysql_query(mysql,"INSERT INTO test_open_direct(id) VALUES(20)"); + rc= mysql_query(mysql, "INSERT INTO test_open_direct(id) VALUES(20)"); myquery(rc); /* run a direct query with store result */ - stmt= mysql_simple_prepare(mysql,"SELECT * FROM test_open_direct"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_open_direct"); check_stmt(stmt); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_stmt_store_result(stmt); + rc= mysql_stmt_store_result(stmt); check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - rc = mysql_query(mysql,"drop table test_open_direct"); + rc= mysql_query(mysql, "drop table test_open_direct"); myquery(rc); - rc = mysql_stmt_close(stmt); + rc= mysql_stmt_close(stmt); check_execute(stmt, rc); } -/* - To test fetch without prior bound buffers -*/ + +/* Test fetch without prior bound buffers */ + static void test_fetch_nobuffs() { MYSQL_STMT *stmt; @@ -6101,15 +5908,15 @@ static void test_fetch_nobuffs() myheader("test_fetch_nobuffs"); - stmt = mysql_simple_prepare(mysql,"SELECT DATABASE(), CURRENT_USER(), \ + stmt= mysql_simple_prepare(mysql, "SELECT DATABASE(), CURRENT_USER(), \ CURRENT_DATE(), CURRENT_TIME()"); check_stmt(stmt); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = 0; - while (mysql_fetch(stmt) != MYSQL_NO_DATA) + rc= 0; + while (mysql_stmt_fetch(stmt) != MYSQL_NO_DATA) rc++; fprintf(stdout, "\n total rows : %d", rc); @@ -6125,14 +5932,14 @@ static void test_fetch_nobuffs() bind[2].buffer= (char *)str[2]; bind[3].buffer= (char *)str[3]; - rc = mysql_bind_result(stmt, bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = 0; - while (mysql_fetch(stmt) != MYSQL_NO_DATA) + rc= 0; + while (mysql_stmt_fetch(stmt) != MYSQL_NO_DATA) { rc++; fprintf(stdout, "\n CURRENT_DATABASE(): %s", str[0]); @@ -6146,9 +5953,9 @@ static void test_fetch_nobuffs() mysql_stmt_close(stmt); } -/* - To test a misc bug -*/ + +/* Test a misc bug */ + static void test_ushort_bug() { MYSQL_STMT *stmt; @@ -6162,30 +5969,30 @@ static void test_ushort_bug() myheader("test_ushort_bug"); - rc= mysql_query(mysql,"DROP TABLE IF EXISTS test_ushort"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_ushort"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_ushort(a smallint unsigned, \ + + rc= mysql_query(mysql, "CREATE TABLE test_ushort(a smallint unsigned, \ b smallint unsigned, \ c smallint unsigned, \ d smallint unsigned)"); myquery(rc); - - rc= mysql_query(mysql,"INSERT INTO test_ushort VALUES(35999, 35999, 35999, 200)"); + + rc= mysql_query(mysql, "INSERT INTO test_ushort VALUES(35999, 35999, 35999, 200)"); myquery(rc); - - - stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_ushort"); + + + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_ushort"); check_stmt(stmt); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); bind[0].buffer_type= MYSQL_TYPE_SHORT; bind[0].buffer= (char *)&short_value; bind[0].is_null= 0; bind[0].length= &s_length; - + bind[1].buffer_type= MYSQL_TYPE_LONG; bind[1].buffer= (char *)&long_value; bind[1].is_null= 0; @@ -6195,26 +6002,26 @@ static void test_ushort_bug() bind[2].buffer= (char *)&longlong_value; bind[2].is_null= 0; bind[2].length= &ll_length; - + bind[3].buffer_type= MYSQL_TYPE_TINY; bind[3].buffer= (char *)&tiny_value; bind[3].is_null= 0; bind[3].length= &t_length; - - rc = mysql_bind_result(stmt, bind); + + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - - fprintf(stdout,"\n ushort : %d (%ld)", short_value, s_length); - fprintf(stdout,"\n ulong : %ld (%ld)", long_value, l_length); - fprintf(stdout,"\n longlong : %lld (%ld)", longlong_value, ll_length); - fprintf(stdout,"\n tinyint : %d (%ld)", tiny_value, t_length); - + + fprintf(stdout, "\n ushort : %d (%ld)", short_value, s_length); + fprintf(stdout, "\n ulong : %ld (%ld)", long_value, l_length); + fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length); + fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length); + assert(short_value == 35999); assert(s_length == 2); - + assert(long_value == 35999); assert(l_length == 4); @@ -6223,16 +6030,16 @@ static void test_ushort_bug() assert(tiny_value == 200); assert(t_length == 1); - - rc = mysql_fetch(stmt); + + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } -/* - To test a misc smallint-signed conversion bug -*/ + +/* Test a misc smallint-signed conversion bug */ + static void test_sshort_bug() { MYSQL_STMT *stmt; @@ -6246,30 +6053,30 @@ static void test_sshort_bug() myheader("test_sshort_bug"); - rc= mysql_query(mysql,"DROP TABLE IF EXISTS test_sshort"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_sshort"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_sshort(a smallint signed, \ + + rc= mysql_query(mysql, "CREATE TABLE test_sshort(a smallint signed, \ b smallint signed, \ c smallint unsigned, \ d smallint unsigned)"); myquery(rc); - - rc= mysql_query(mysql,"INSERT INTO test_sshort VALUES(-5999, -5999, 35999, 200)"); + + rc= mysql_query(mysql, "INSERT INTO test_sshort VALUES(-5999, -5999, 35999, 200)"); myquery(rc); - - - stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_sshort"); + + + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_sshort"); check_stmt(stmt); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); bind[0].buffer_type= MYSQL_TYPE_SHORT; bind[0].buffer= (char *)&short_value; bind[0].is_null= 0; bind[0].length= &s_length; - + bind[1].buffer_type= MYSQL_TYPE_LONG; bind[1].buffer= (char *)&long_value; bind[1].is_null= 0; @@ -6279,26 +6086,26 @@ static void test_sshort_bug() bind[2].buffer= (char *)&longlong_value; bind[2].is_null= 0; bind[2].length= &ll_length; - + bind[3].buffer_type= MYSQL_TYPE_TINY; bind[3].buffer= (char *)&tiny_value; bind[3].is_null= 0; bind[3].length= &t_length; - - rc = mysql_bind_result(stmt, bind); + + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - - fprintf(stdout,"\n sshort : %d (%ld)", short_value, s_length); - fprintf(stdout,"\n slong : %ld (%ld)", long_value, l_length); - fprintf(stdout,"\n longlong : %lld (%ld)", longlong_value, ll_length); - fprintf(stdout,"\n tinyint : %d (%ld)", tiny_value, t_length); - + + fprintf(stdout, "\n sshort : %d (%ld)", short_value, s_length); + fprintf(stdout, "\n slong : %ld (%ld)", long_value, l_length); + fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length); + fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length); + assert(short_value == -5999); assert(s_length == 2); - + assert(long_value == -5999); assert(l_length == 4); @@ -6307,16 +6114,16 @@ static void test_sshort_bug() assert(tiny_value == 200); assert(t_length == 1); - - rc = mysql_fetch(stmt); + + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } -/* - To test a misc tinyint-signed conversion bug -*/ + +/* Test a misc tinyint-signed conversion bug */ + static void test_stiny_bug() { MYSQL_STMT *stmt; @@ -6330,30 +6137,30 @@ static void test_stiny_bug() myheader("test_stiny_bug"); - rc= mysql_query(mysql,"DROP TABLE IF EXISTS test_stiny"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_stiny"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_stiny(a tinyint signed, \ + + rc= mysql_query(mysql, "CREATE TABLE test_stiny(a tinyint signed, \ b tinyint signed, \ c tinyint unsigned, \ d tinyint unsigned)"); myquery(rc); - - rc= mysql_query(mysql,"INSERT INTO test_stiny VALUES(-128, -127, 255, 0)"); + + rc= mysql_query(mysql, "INSERT INTO test_stiny VALUES(-128, -127, 255, 0)"); myquery(rc); - - - stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_stiny"); + + + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_stiny"); check_stmt(stmt); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); bind[0].buffer_type= MYSQL_TYPE_SHORT; bind[0].buffer= (char *)&short_value; bind[0].is_null= 0; bind[0].length= &s_length; - + bind[1].buffer_type= MYSQL_TYPE_LONG; bind[1].buffer= (char *)&long_value; bind[1].is_null= 0; @@ -6363,26 +6170,26 @@ static void test_stiny_bug() bind[2].buffer= (char *)&longlong_value; bind[2].is_null= 0; bind[2].length= &ll_length; - + bind[3].buffer_type= MYSQL_TYPE_TINY; bind[3].buffer= (char *)&tiny_value; bind[3].is_null= 0; bind[3].length= &t_length; - - rc = mysql_bind_result(stmt, bind); + + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - - fprintf(stdout,"\n sshort : %d (%ld)", short_value, s_length); - fprintf(stdout,"\n slong : %ld (%ld)", long_value, l_length); - fprintf(stdout,"\n longlong : %lld (%ld)", longlong_value, ll_length); - fprintf(stdout,"\n tinyint : %d (%ld)", tiny_value, t_length); - + + fprintf(stdout, "\n sshort : %d (%ld)", short_value, s_length); + fprintf(stdout, "\n slong : %ld (%ld)", long_value, l_length); + fprintf(stdout, "\n longlong : %lld (%ld)", longlong_value, ll_length); + fprintf(stdout, "\n tinyint : %d (%ld)", tiny_value, t_length); + assert(short_value == -128); assert(s_length == 2); - + assert(long_value == -127); assert(l_length == 4); @@ -6391,16 +6198,16 @@ static void test_stiny_bug() assert(tiny_value == 0); assert(t_length == 1); - - rc = mysql_fetch(stmt); + + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } -/******************************************************** -* to test misc field information, bug: #74 * -*********************************************************/ + +/* Test misc field information, bug: #74 */ + static void test_field_misc() { MYSQL_STMT *stmt; @@ -6412,47 +6219,47 @@ static void test_field_misc() myheader("test_field_misc"); - rc = mysql_query(mysql,"SELECT @@autocommit"); + rc= mysql_query(mysql, "SELECT @@autocommit"); myquery(rc); - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(1 == my_process_result_set(result)); - - verify_prepare_field(result,0, - "@@autocommit","", /* field and its org name */ + + verify_prepare_field(result, 0, + "@@autocommit", "", /* field and its org name */ MYSQL_TYPE_LONGLONG, /* field type */ "", "", /* table and its org name */ - "",1,0); /* db name, length(its bool flag)*/ + "", 1, 0); /* db name, length(its bool flag)*/ mysql_free_result(result); - - stmt = mysql_simple_prepare(mysql,"SELECT @@autocommit"); - check_stmt(stmt); - - rc = mysql_execute(stmt); - check_execute(stmt,rc); - result = mysql_get_metadata(stmt); + stmt= mysql_simple_prepare(mysql, "SELECT @@autocommit"); + check_stmt(stmt); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + result= mysql_stmt_result_metadata(stmt); mytest(result); - + assert(1 == my_process_stmt_result(stmt)); - - verify_prepare_field(result,0, - "@@autocommit","", /* field and its org name */ + + verify_prepare_field(result, 0, + "@@autocommit", "", /* field and its org name */ MYSQL_TYPE_LONGLONG, /* field type */ "", "", /* table and its org name */ - "",1,0); /* db name, length(its bool flag)*/ + "", 1, 0); /* db name, length(its bool flag)*/ mysql_free_result(result); mysql_stmt_close(stmt); - stmt = mysql_simple_prepare(mysql, "SELECT @@table_type"); + stmt= mysql_simple_prepare(mysql, "SELECT @@table_type"); check_stmt(stmt); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].buffer= table_type; @@ -6460,94 +6267,95 @@ static void test_field_misc() bind[0].is_null= 0; bind[0].buffer_length= NAME_LEN; - rc = mysql_bind_result(stmt, bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_result(stmt, bind); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); - fprintf(stdout,"\n default table type: %s(%ld)", table_type, type_length); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); + fprintf(stdout, "\n default table type: %s(%ld)", table_type, type_length); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); - stmt = mysql_simple_prepare(mysql, "SELECT @@table_type"); + stmt= mysql_simple_prepare(mysql, "SELECT @@table_type"); check_stmt(stmt); - result = mysql_get_metadata(stmt); + result= mysql_stmt_result_metadata(stmt); mytest(result); + assert(mysql_stmt_field_count(stmt) == mysql_num_fields(result)); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); assert(1 == my_process_stmt_result(stmt)); - - verify_prepare_field(result,0, - "@@table_type","", /* field and its org name */ + + verify_prepare_field(result, 0, + "@@table_type", "", /* field and its org name */ MYSQL_TYPE_STRING, /* field type */ "", "", /* table and its org name */ - "",type_length*3,0); /* db name, length */ + "", type_length*3, 0); /* db name, length */ mysql_free_result(result); mysql_stmt_close(stmt); - stmt = mysql_simple_prepare(mysql, "SELECT @@max_error_count"); + stmt= mysql_simple_prepare(mysql, "SELECT @@max_error_count"); check_stmt(stmt); - result = mysql_get_metadata(stmt); + result= mysql_stmt_result_metadata(stmt); mytest(result); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); assert(1 == my_process_stmt_result(stmt)); - - verify_prepare_field(result,0, - "@@max_error_count","", /* field and its org name */ + + verify_prepare_field(result, 0, + "@@max_error_count", "", /* field and its org name */ MYSQL_TYPE_LONGLONG, /* field type */ "", "", /* table and its org name */ - "",10,0); /* db name, length */ + "", 10, 0); /* db name, length */ mysql_free_result(result); mysql_stmt_close(stmt); - - stmt = mysql_simple_prepare(mysql, "SELECT @@max_allowed_packet"); + + stmt= mysql_simple_prepare(mysql, "SELECT @@max_allowed_packet"); check_stmt(stmt); - result = mysql_get_metadata(stmt); + result= mysql_stmt_result_metadata(stmt); mytest(result); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); assert(1 == my_process_stmt_result(stmt)); - - verify_prepare_field(result,0, - "@@max_allowed_packet","", /* field and its org name */ + + verify_prepare_field(result, 0, + "@@max_allowed_packet", "", /* field and its org name */ MYSQL_TYPE_LONGLONG, /* field type */ "", "", /* table and its org name */ - "",10,0); /* db name, length */ + "", 10, 0); /* db name, length */ mysql_free_result(result); mysql_stmt_close(stmt); - - stmt = mysql_simple_prepare(mysql, "SELECT @@sql_warnings"); + + stmt= mysql_simple_prepare(mysql, "SELECT @@sql_warnings"); check_stmt(stmt); - - result = mysql_get_metadata(stmt); + + result= mysql_stmt_result_metadata(stmt); mytest(result); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); assert(1 == my_process_stmt_result(stmt)); - - verify_prepare_field(result,0, - "@@sql_warnings","", /* field and its org name */ + + verify_prepare_field(result, 0, + "@@sql_warnings", "", /* field and its org name */ MYSQL_TYPE_LONGLONG, /* field type */ "", "", /* table and its org name */ - "",1,0); /* db name, length */ + "", 1, 0); /* db name, length */ mysql_free_result(result); mysql_stmt_close(stmt); @@ -6555,9 +6363,10 @@ static void test_field_misc() /* - To test SET OPTION feature with prepare stmts + Test SET OPTION feature with prepare stmts bug #85 (reported by mark@mysql.com) */ + static void test_set_option() { MYSQL_STMT *stmt; @@ -6569,60 +6378,62 @@ static void test_set_option() mysql_autocommit(mysql, TRUE); /* LIMIT the rows count to 2 */ - rc= mysql_query(mysql,"SET OPTION SQL_SELECT_LIMIT=2"); + rc= mysql_query(mysql, "SET OPTION SQL_SELECT_LIMIT= 2"); myquery(rc); - rc= mysql_query(mysql,"DROP TABLE IF EXISTS test_limit"); - myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_limit(a tinyint)"); - myquery(rc); - - rc= mysql_query(mysql,"INSERT INTO test_limit VALUES(10),(20),(30),(40)"); - myquery(rc); - - fprintf(stdout,"\n with SQL_SELECT_LIMIT=2 (direct)"); - rc = mysql_query(mysql,"SELECT * FROM test_limit"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_limit"); myquery(rc); - result = mysql_store_result(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_limit(a tinyint)"); + myquery(rc); + + rc= mysql_query(mysql, "INSERT INTO test_limit VALUES(10), (20), (30), (40)"); + myquery(rc); + + fprintf(stdout, "\n with SQL_SELECT_LIMIT= 2 (direct)"); + rc= mysql_query(mysql, "SELECT * FROM test_limit"); + myquery(rc); + + result= mysql_store_result(mysql); mytest(result); assert(2 == my_process_result_set(result)); mysql_free_result(result); - - fprintf(stdout,"\n with SQL_SELECT_LIMIT=2 (prepare)"); - stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_limit"); + + fprintf(stdout, "\n with SQL_SELECT_LIMIT=2 (prepare)"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_limit"); check_stmt(stmt); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); assert(2 == my_process_stmt_result(stmt)); mysql_stmt_close(stmt); - /* RESET the LIMIT the rows count to 0 */ - fprintf(stdout,"\n with SQL_SELECT_LIMIT=DEFAULT (prepare)"); - rc= mysql_query(mysql,"SET OPTION SQL_SELECT_LIMIT=DEFAULT"); + /* RESET the LIMIT the rows count to 0 */ + fprintf(stdout, "\n with SQL_SELECT_LIMIT=DEFAULT (prepare)"); + rc= mysql_query(mysql, "SET OPTION SQL_SELECT_LIMIT=DEFAULT"); myquery(rc); - - stmt = mysql_simple_prepare(mysql, "SELECT * FROM test_limit"); + + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_limit"); check_stmt(stmt); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); assert(4 == my_process_stmt_result(stmt)); mysql_stmt_close(stmt); } + /* - To test a misc GRANT option + Test a misc GRANT option bug #89 (reported by mark@mysql.com) */ + static void test_prepare_grant() { int rc; @@ -6631,80 +6442,80 @@ static void test_prepare_grant() mysql_autocommit(mysql, TRUE); - rc= mysql_query(mysql,"DROP TABLE IF EXISTS test_grant"); - myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_grant(a tinyint primary key auto_increment)"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_grant"); myquery(rc); - strxmov(query,"GRANT INSERT,UPDATE,SELECT ON ", current_db, + rc= mysql_query(mysql, "CREATE TABLE test_grant(a tinyint primary key auto_increment)"); + myquery(rc); + + strxmov(query, "GRANT INSERT, UPDATE, SELECT ON ", current_db, ".test_grant TO 'test_grant'@", opt_host ? opt_host : "'localhost'", NullS); - if (mysql_query(mysql,query)) + if (mysql_query(mysql, query)) { myerror("GRANT failed"); - - /* + + /* If server started with --skip-grant-tables, skip this test, else exit to indicate an error - ER_UNKNOWN_COM_ERROR = 1047 - */ - if (mysql_errno(mysql) != 1047) - exit(0); + ER_UNKNOWN_COM_ERROR= 1047 + */ + if (mysql_errno(mysql) != 1047) + exit(0); } else { MYSQL *org_mysql= mysql, *lmysql; MYSQL_STMT *stmt; - + fprintf(stdout, "\n Establishing a test connection ..."); - if (!(lmysql = mysql_init(NULL))) - { + if (!(lmysql= mysql_init(NULL))) + { myerror("mysql_init() failed"); exit(0); } - if (!(mysql_real_connect(lmysql,opt_host,"test_grant", - "", current_db, opt_port, - opt_unix_socket, 0))) + if (!(mysql_real_connect(lmysql, opt_host, "test_grant", + "", current_db, opt_port, + opt_unix_socket, 0))) { - myerror("connection failed"); + myerror("connection failed"); mysql_close(lmysql); exit(0); - } - fprintf(stdout," OK"); + } + fprintf(stdout, " OK"); mysql= lmysql; - rc = mysql_query(mysql,"INSERT INTO test_grant VALUES(NULL)"); + rc= mysql_query(mysql, "INSERT INTO test_grant VALUES(NULL)"); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_grant(a) VALUES(NULL)"); + rc= mysql_query(mysql, "INSERT INTO test_grant(a) VALUES(NULL)"); myquery(rc); - - execute_prepare_query("INSERT INTO test_grant(a) VALUES(NULL)",1); - execute_prepare_query("INSERT INTO test_grant VALUES(NULL)",1); - execute_prepare_query("UPDATE test_grant SET a=9 WHERE a=1",1); + + execute_prepare_query("INSERT INTO test_grant(a) VALUES(NULL)", 1); + execute_prepare_query("INSERT INTO test_grant VALUES(NULL)", 1); + execute_prepare_query("UPDATE test_grant SET a=9 WHERE a=1", 1); assert(4 == my_stmt_result("SELECT a FROM test_grant")); /* Both DELETE expected to fail as user does not have DELETE privs */ - rc = mysql_query(mysql,"DELETE FROM test_grant"); + rc= mysql_query(mysql, "DELETE FROM test_grant"); myquery_r(rc); - stmt= mysql_simple_prepare(mysql,"DELETE FROM test_grant"); + stmt= mysql_simple_prepare(mysql, "DELETE FROM test_grant"); check_stmt_r(stmt); - + assert(4 == my_stmt_result("SELECT * FROM test_grant")); - - mysql_close(lmysql); + + mysql_close(lmysql); mysql= org_mysql; - rc = mysql_query(mysql,"delete from mysql.user where User='test_grant'"); + rc= mysql_query(mysql, "delete from mysql.user where User='test_grant'"); myquery(rc); assert(1 == mysql_affected_rows(mysql)); - rc = mysql_query(mysql,"delete from mysql.tables_priv where User='test_grant'"); + rc= mysql_query(mysql, "delete from mysql.tables_priv where User='test_grant'"); myquery(rc); assert(1 == mysql_affected_rows(mysql)); @@ -6713,10 +6524,11 @@ static void test_prepare_grant() /* - To test a crash when invalid/corrupted .frm is used in the + Test a crash when invalid/corrupted .frm is used in the SHOW TABLE STATUS bug #93 (reported by serg@mysql.com). */ + static void test_frm_bug() { MYSQL_STMT *stmt; @@ -6732,74 +6544,74 @@ static void test_frm_bug() mysql_autocommit(mysql, TRUE); - rc= mysql_query(mysql,"drop table if exists test_frm_bug"); + rc= mysql_query(mysql, "drop table if exists test_frm_bug"); myquery(rc); - rc= mysql_query(mysql,"flush tables"); + rc= mysql_query(mysql, "flush tables"); myquery(rc); - - stmt = mysql_simple_prepare(mysql, "show variables like 'datadir'"); + + stmt= mysql_simple_prepare(mysql, "show variables like 'datadir'"); check_stmt(stmt); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].buffer= data_dir; bind[0].buffer_length= NAME_LEN; bind[0].is_null= 0; bind[0].length= 0; - bind[1]=bind[0]; + bind[1]= bind[0]; - rc = mysql_bind_result(stmt,bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_result(stmt, bind); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout,"\n data directory: %s", data_dir); + fprintf(stdout, "\n data directory: %s", data_dir); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); - strxmov(test_frm,data_dir,"/",current_db,"/","test_frm_bug.frm",NullS); + strxmov(test_frm, data_dir, "/", current_db, "/", "test_frm_bug.frm", NullS); - fprintf(stdout,"\n test_frm: %s", test_frm); + fprintf(stdout, "\n test_frm: %s", test_frm); if (!(test_file= my_fopen(test_frm, (int) (O_RDWR | O_CREAT), MYF(MY_WME)))) { - fprintf(stdout,"\n ERROR: my_fopen failed for '%s'", test_frm); - fprintf(stdout,"\n test cancelled"); - return; + fprintf(stdout, "\n ERROR: my_fopen failed for '%s'", test_frm); + fprintf(stdout, "\n test cancelled"); + return; } - fprintf(test_file,"this is a junk file for test"); + fprintf(test_file, "this is a junk file for test"); - rc = mysql_query(mysql,"SHOW TABLE STATUS like 'test_frm_bug'"); + rc= mysql_query(mysql, "SHOW TABLE STATUS like 'test_frm_bug'"); myquery(rc); - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result);/* It can't be NULL */ assert(1 == my_process_result_set(result)); - mysql_data_seek(result,0); + mysql_data_seek(result, 0); row= mysql_fetch_row(result); mytest(row); - fprintf(stdout,"\n Comment: %s", row[16]); + fprintf(stdout, "\n Comment: %s", row[16]); assert(row[16] != 0); mysql_free_result(result); mysql_stmt_close(stmt); - my_fclose(test_file,MYF(0)); - mysql_query(mysql,"drop table if exists test_frm_bug"); + my_fclose(test_file, MYF(0)); + mysql_query(mysql, "drop table if exists test_frm_bug"); } -/* - To test DECIMAL conversion -*/ + +/* Test DECIMAL conversion */ + static void test_decimal_bug() { MYSQL_STMT *stmt; @@ -6812,94 +6624,96 @@ static void test_decimal_bug() mysql_autocommit(mysql, TRUE); - rc= mysql_query(mysql,"drop table if exists test_decimal_bug"); - myquery(rc); - - rc = mysql_query(mysql, "create table test_decimal_bug(c1 decimal(10,2))"); - myquery(rc); - - rc = mysql_query(mysql, "insert into test_decimal_bug value(8),(10.22),(5.61)"); + rc= mysql_query(mysql, "drop table if exists test_decimal_bug"); myquery(rc); - stmt = mysql_simple_prepare(mysql,"select c1 from test_decimal_bug where c1= ?"); + rc= mysql_query(mysql, "create table test_decimal_bug(c1 decimal(10, 2))"); + myquery(rc); + + rc= mysql_query(mysql, "insert into test_decimal_bug value(8), (10.22), (5.61)"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "select c1 from test_decimal_bug where c1= ?"); check_stmt(stmt); + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); + bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].buffer= (char *)data; bind[0].buffer_length= 25; bind[0].is_null= &is_null; - bind[0].length= 0; - is_null= 0; - rc = mysql_bind_param(stmt, bind); - check_execute(stmt,rc); + is_null= 0; + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); strcpy(data, "8.0"); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - data[0]=0; - rc = mysql_bind_result(stmt, bind); - check_execute(stmt,rc); + data[0]= 0; + rc= mysql_stmt_bind_result(stmt, bind); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); fprintf(stdout, "\n data: %s", data); - assert(strcmp(data, "8.00")==0); + assert(strcmp(data, "8.00") == 0); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); strcpy(data, "5.61"); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - data[0]=0; - rc = mysql_bind_result(stmt, bind); - check_execute(stmt,rc); + data[0]= 0; + rc= mysql_stmt_bind_result(stmt, bind); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); fprintf(stdout, "\n data: %s", data); - assert(strcmp(data, "5.61")==0); + assert(strcmp(data, "5.61") == 0); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); is_null= 1; - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); strcpy(data, "10.22"); is_null= 0; - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - data[0]=0; - rc = mysql_bind_result(stmt, bind); - check_execute(stmt,rc); + data[0]= 0; + rc= mysql_stmt_bind_result(stmt, bind); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); fprintf(stdout, "\n data: %s", data); - assert(strcmp(data, "10.22")==0); + assert(strcmp(data, "10.22") == 0); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } -/* - To test EXPLAIN bug - bug #115 (reported by mark@mysql.com & georg@php.net). -*/ +/* Test EXPLAIN bug (#115, reported by mark@mysql.com & georg@php.net). */ static void test_explain_bug() { @@ -6909,94 +6723,94 @@ static void test_explain_bug() myheader("test_explain_bug"); - mysql_autocommit(mysql,TRUE); + mysql_autocommit(mysql, TRUE); - rc = mysql_query(mysql, "DROP TABLE IF EXISTS test_explain"); - myquery(rc); - - rc = mysql_query(mysql, "CREATE TABLE test_explain(id int, name char(2))"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_explain"); myquery(rc); - stmt = mysql_simple_prepare(mysql, "explain test_explain"); + rc= mysql_query(mysql, "CREATE TABLE test_explain(id int, name char(2))"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "explain test_explain"); check_stmt(stmt); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - assert( 2 == my_process_stmt_result(stmt)); + assert( 2 == my_process_stmt_result(stmt)); - result = mysql_get_metadata(stmt); + result= mysql_stmt_result_metadata(stmt); mytest(result); - fprintf(stdout, "\n total fields in the result: %d", + fprintf(stdout, "\n total fields in the result: %d", mysql_num_fields(result)); assert(6 == mysql_num_fields(result)); - verify_prepare_field(result,0,"Field","",MYSQL_TYPE_VAR_STRING, - "","","",NAME_LEN,0); + verify_prepare_field(result, 0, "Field", "", MYSQL_TYPE_VAR_STRING, + "", "", "", NAME_LEN, 0); - verify_prepare_field(result,1,"Type","",MYSQL_TYPE_VAR_STRING, - "","","",40,0); + verify_prepare_field(result, 1, "Type", "", MYSQL_TYPE_VAR_STRING, + "", "", "", 40, 0); - verify_prepare_field(result,2,"Null","",MYSQL_TYPE_VAR_STRING, - "","","",1,0); + verify_prepare_field(result, 2, "Null", "", MYSQL_TYPE_VAR_STRING, + "", "", "", 1, 0); - verify_prepare_field(result,3,"Key","",MYSQL_TYPE_VAR_STRING, - "","","",3,0); + verify_prepare_field(result, 3, "Key", "", MYSQL_TYPE_VAR_STRING, + "", "", "", 3, 0); - verify_prepare_field(result,4,"Default","",MYSQL_TYPE_VAR_STRING, - "","","",NAME_LEN,0); + verify_prepare_field(result, 4, "Default", "", MYSQL_TYPE_VAR_STRING, + "", "", "", NAME_LEN, 0); - verify_prepare_field(result,5,"Extra","",MYSQL_TYPE_VAR_STRING, - "","","",20,0); + verify_prepare_field(result, 5, "Extra", "", MYSQL_TYPE_VAR_STRING, + "", "", "", 20, 0); mysql_free_result(result); mysql_stmt_close(stmt); - - stmt = mysql_simple_prepare(mysql, "explain select id, name FROM test_explain"); + + stmt= mysql_simple_prepare(mysql, "explain select id, name FROM test_explain"); check_stmt(stmt); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - assert( 1 == my_process_stmt_result(stmt)); + assert( 1 == my_process_stmt_result(stmt)); - result = mysql_get_metadata(stmt); + result= mysql_stmt_result_metadata(stmt); mytest(result); - fprintf(stdout, "\n total fields in the result: %d", + fprintf(stdout, "\n total fields in the result: %d", mysql_num_fields(result)); assert(10 == mysql_num_fields(result)); - verify_prepare_field(result,0,"id","",MYSQL_TYPE_LONGLONG, - "","","",3,0); + verify_prepare_field(result, 0, "id", "", MYSQL_TYPE_LONGLONG, + "", "", "", 3, 0); - verify_prepare_field(result,1,"select_type","",MYSQL_TYPE_VAR_STRING, - "","","",19,0); + verify_prepare_field(result, 1, "select_type", "", MYSQL_TYPE_VAR_STRING, + "", "", "", 19, 0); - verify_prepare_field(result,2,"table","",MYSQL_TYPE_VAR_STRING, - "","","",NAME_LEN,0); + verify_prepare_field(result, 2, "table", "", MYSQL_TYPE_VAR_STRING, + "", "", "", NAME_LEN, 0); - verify_prepare_field(result,3,"type","",MYSQL_TYPE_VAR_STRING, - "","","",10,0); + verify_prepare_field(result, 3, "type", "", MYSQL_TYPE_VAR_STRING, + "", "", "", 10, 0); - verify_prepare_field(result,4,"possible_keys","",MYSQL_TYPE_VAR_STRING, - "","","",NAME_LEN*64,0); + verify_prepare_field(result, 4, "possible_keys", "", MYSQL_TYPE_VAR_STRING, + "", "", "", NAME_LEN*64, 0); - verify_prepare_field(result,5,"key","",MYSQL_TYPE_VAR_STRING, - "","","",NAME_LEN,0); + verify_prepare_field(result, 5, "key", "", MYSQL_TYPE_VAR_STRING, + "", "", "", NAME_LEN, 0); - verify_prepare_field(result,6,"key_len","",MYSQL_TYPE_LONGLONG, - "","","",3,0); + verify_prepare_field(result, 6, "key_len", "", MYSQL_TYPE_LONGLONG, + "", "", "", 3, 0); - verify_prepare_field(result,7,"ref","",MYSQL_TYPE_VAR_STRING, - "","","",NAME_LEN*16,0); + verify_prepare_field(result, 7, "ref", "", MYSQL_TYPE_VAR_STRING, + "", "", "", NAME_LEN*16, 0); - verify_prepare_field(result,8,"rows","",MYSQL_TYPE_LONGLONG, - "","","",10,0); + verify_prepare_field(result, 8, "rows", "", MYSQL_TYPE_LONGLONG, + "", "", "", 10, 0); - verify_prepare_field(result,9,"Extra","",MYSQL_TYPE_VAR_STRING, - "","","",255,0); + verify_prepare_field(result, 9, "Extra", "", MYSQL_TYPE_VAR_STRING, + "", "", "", 255, 0); mysql_free_result(result); mysql_stmt_close(stmt); @@ -7005,131 +6819,132 @@ static void test_explain_bug() #ifdef NOT_YET_WORKING /* - To test math functions - bug #148 (reported by salle@mysql.com). + Test math functions. + Bug #148 (reported by salle@mysql.com). */ #define myerrno(n) check_errcode(n) static void check_errcode(const unsigned int err) -{ +{ if (mysql->server_version) - fprintf(stdout,"\n [MySQL-%s]",mysql->server_version); + fprintf(stdout, "\n [MySQL-%s]", mysql->server_version); else - fprintf(stdout,"\n [MySQL]"); - fprintf(stdout,"[%d] %s\n",mysql_errno(mysql),mysql_error(mysql)); + fprintf(stdout, "\n [MySQL]"); + fprintf(stdout, "[%d] %s\n", mysql_errno(mysql), mysql_error(mysql)); assert(mysql_errno(mysql) == err); } + static void test_drop_temp() { int rc; myheader("test_drop_temp"); - rc= mysql_query(mysql,"DROP DATABASE IF EXISTS test_drop_temp_db"); + rc= mysql_query(mysql, "DROP DATABASE IF EXISTS test_drop_temp_db"); myquery(rc); - rc= mysql_query(mysql,"CREATE DATABASE test_drop_temp_db"); - myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_drop_temp_db.t1(c1 int, c2 char(1))"); + rc= mysql_query(mysql, "CREATE DATABASE test_drop_temp_db"); myquery(rc); - rc = mysql_query(mysql,"delete from mysql.db where Db='test_drop_temp_db'"); + rc= mysql_query(mysql, "CREATE TABLE test_drop_temp_db.t1(c1 int, c2 char(1))"); myquery(rc); - rc = mysql_query(mysql,"delete from mysql.db where Db='test_drop_temp_db'"); + rc= mysql_query(mysql, "delete from mysql.db where Db='test_drop_temp_db'"); myquery(rc); - strxmov(query,"GRANT SELECT,USAGE,DROP ON test_drop_temp_db.* TO test_temp@", + rc= mysql_query(mysql, "delete from mysql.db where Db='test_drop_temp_db'"); + myquery(rc); + + strxmov(query, "GRANT SELECT, USAGE, DROP ON test_drop_temp_db.* TO test_temp@", opt_host ? opt_host : "localhost", NullS); - if (mysql_query(mysql,query)) + if (mysql_query(mysql, query)) { myerror("GRANT failed"); - - /* + + /* If server started with --skip-grant-tables, skip this test, else exit to indicate an error - ER_UNKNOWN_COM_ERROR = 1047 - */ - if (mysql_errno(mysql) != 1047) - exit(0); + ER_UNKNOWN_COM_ERROR= 1047 + */ + if (mysql_errno(mysql) != 1047) + exit(0); } else { MYSQL *org_mysql= mysql, *lmysql; - + fprintf(stdout, "\n Establishing a test connection ..."); - if (!(lmysql = mysql_init(NULL))) - { + if (!(lmysql= mysql_init(NULL))) + { myerror("mysql_init() failed"); exit(0); } - rc = mysql_query(mysql,"flush privileges"); + rc= mysql_query(mysql, "flush privileges"); myquery(rc); - if (!(mysql_real_connect(lmysql,opt_host ? opt_host : "localhost","test_temp", - "", "test_drop_temp_db", opt_port, - opt_unix_socket, 0))) + if (!(mysql_real_connect(lmysql, opt_host ? opt_host : "localhost", "test_temp", + "", "test_drop_temp_db", opt_port, + opt_unix_socket, 0))) { mysql= lmysql; - myerror("connection failed"); + myerror("connection failed"); mysql_close(lmysql); exit(0); - } - fprintf(stdout," OK"); + } + fprintf(stdout, " OK"); mysql= lmysql; - rc = mysql_query(mysql,"INSERT INTO t1 VALUES(10,'C')"); + rc= mysql_query(mysql, "INSERT INTO t1 VALUES(10, 'C')"); myerrno((uint)1142); - rc = mysql_query(mysql,"DROP TABLE t1"); + rc= mysql_query(mysql, "DROP TABLE t1"); myerrno((uint)1142); - + mysql= org_mysql; - rc= mysql_query(mysql,"CREATE TEMPORARY TABLE test_drop_temp_db.t1(c1 int)"); + rc= mysql_query(mysql, "CREATE TEMPORARY TABLE test_drop_temp_db.t1(c1 int)"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TEMPORARY TABLE test_drop_temp_db.t2 LIKE test_drop_temp_db.t1"); + + rc= mysql_query(mysql, "CREATE TEMPORARY TABLE test_drop_temp_db.t2 LIKE test_drop_temp_db.t1"); myquery(rc); mysql= lmysql; - rc = mysql_query(mysql,"DROP TABLE t1,t2"); + rc= mysql_query(mysql, "DROP TABLE t1, t2"); myquery_r(rc); - rc = mysql_query(mysql,"DROP TEMPORARY TABLE t1"); + rc= mysql_query(mysql, "DROP TEMPORARY TABLE t1"); myquery_r(rc); - rc = mysql_query(mysql,"DROP TEMPORARY TABLE t2"); + rc= mysql_query(mysql, "DROP TEMPORARY TABLE t2"); myquery_r(rc); - - mysql_close(lmysql); + + mysql_close(lmysql); mysql= org_mysql; - rc = mysql_query(mysql,"drop database test_drop_temp_db"); + rc= mysql_query(mysql, "drop database test_drop_temp_db"); myquery(rc); assert(1 == mysql_affected_rows(mysql)); - rc = mysql_query(mysql,"delete from mysql.user where User='test_temp'"); + rc= mysql_query(mysql, "delete from mysql.user where User='test_temp'"); myquery(rc); assert(1 == mysql_affected_rows(mysql)); - rc = mysql_query(mysql,"delete from mysql.tables_priv where User='test_temp'"); + rc= mysql_query(mysql, "delete from mysql.tables_priv where User='test_temp'"); myquery(rc); assert(1 == mysql_affected_rows(mysql)); } } #endif -/* - To test warnings for cuted rows -*/ + +/* Test warnings for cuted rows */ + static void test_cuted_rows() { int rc, count; @@ -7137,58 +6952,58 @@ static void test_cuted_rows() myheader("test_cuted_rows"); - mysql_query(mysql, "DROP TABLE if exists t1"); + mysql_query(mysql, "DROP TABLE if exists t1"); mysql_query(mysql, "DROP TABLE if exists t2"); - rc = mysql_query(mysql, "CREATE TABLE t1(c1 tinyint)"); + rc= mysql_query(mysql, "CREATE TABLE t1(c1 tinyint)"); myquery(rc); - rc = mysql_query(mysql, "CREATE TABLE t2(c1 int not null)"); + rc= mysql_query(mysql, "CREATE TABLE t2(c1 int not null)"); myquery(rc); - rc = mysql_query(mysql, "INSERT INTO t1 values(10),(NULL),(NULL)"); + rc= mysql_query(mysql, "INSERT INTO t1 values(10), (NULL), (NULL)"); myquery(rc); count= mysql_warning_count(mysql); fprintf(stdout, "\n total warnings: %d", count); assert(count == 0); - rc = mysql_query(mysql, "INSERT INTO t2 SELECT * FROM t1"); + rc= mysql_query(mysql, "INSERT INTO t2 SELECT * FROM t1"); myquery(rc); count= mysql_warning_count(mysql); fprintf(stdout, "\n total warnings: %d", count); assert(count == 2); - rc = mysql_query(mysql, "SHOW WARNINGS"); + rc= mysql_query(mysql, "SHOW WARNINGS"); myquery(rc); - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(2 == my_process_result_set(result)); mysql_free_result(result); - rc = mysql_query(mysql, "INSERT INTO t1 VALUES('junk'),(876789)"); + rc= mysql_query(mysql, "INSERT INTO t1 VALUES('junk'), (876789)"); myquery(rc); count= mysql_warning_count(mysql); fprintf(stdout, "\n total warnings: %d", count); assert(count == 2); - rc = mysql_query(mysql, "SHOW WARNINGS"); + rc= mysql_query(mysql, "SHOW WARNINGS"); myquery(rc); - result = mysql_store_result(mysql); + result= mysql_store_result(mysql); mytest(result); assert(2 == my_process_result_set(result)); mysql_free_result(result); } -/* - To test update/binary logs -*/ + +/* Test update/binary logs */ + static void test_logs() { MYSQL_STMT *stmt; @@ -7201,138 +7016,140 @@ static void test_logs() myheader("test_logs"); - rc = mysql_query(mysql, "DROP TABLE IF EXISTS test_logs"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_logs"); myquery(rc); - rc = mysql_query(mysql, "CREATE TABLE test_logs(id smallint, name varchar(20))"); + rc= mysql_query(mysql, "CREATE TABLE test_logs(id smallint, name varchar(20))"); myquery(rc); - length= (ulong)(strmov((char *)data,"INSERT INTO test_logs VALUES(?,?)") - data); - stmt = mysql_prepare(mysql, data, length); - check_stmt(stmt); - + strmov((char *)data, "INSERT INTO test_logs VALUES(?, ?)"); + stmt= mysql_simple_prepare(mysql, data); + check_stmt(stmt); + + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); + bind[0].buffer_type= MYSQL_TYPE_SHORT; bind[0].buffer= (char *)&id; - bind[0].is_null= 0; - bind[0].length= 0; - + bind[1].buffer_type= MYSQL_TYPE_STRING; bind[1].buffer= (char *)&data; - bind[1].is_null= 0; bind[1].buffer_length= 255; bind[1].length= &length; id= 9876; - length= (ulong)(strmov((char *)data,"MySQL - Open Source Database")- data); + length= (ulong)(strmov((char *)data, "MySQL - Open Source Database")- data); - rc = mysql_bind_param(stmt, bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); strmov((char *)data, "'"); length= 1; - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - + strmov((char *)data, "\""); length= 1; - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - + length= (ulong)(strmov((char *)data, "my\'sql\'")-data); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - + length= (ulong)(strmov((char *)data, "my\"sql\"")-data); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); mysql_stmt_close(stmt); - length= (ulong)(strmov((char *)data,"INSERT INTO test_logs VALUES(20,'mysql')") - data); - stmt = mysql_prepare(mysql, data, length); - check_stmt(stmt); + strmov((char *)data, "INSERT INTO test_logs VALUES(20, 'mysql')"); + stmt= mysql_simple_prepare(mysql, data); + check_stmt(stmt); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); mysql_stmt_close(stmt); - length= (ulong)(strmov((char *)data, "SELECT * FROM test_logs WHERE id=?") - data); - stmt = mysql_prepare(mysql, data, length); - check_stmt(stmt); + strmov((char *)data, "SELECT * FROM test_logs WHERE id=?"); + stmt= mysql_simple_prepare(mysql, data); + check_stmt(stmt); - rc = mysql_bind_param(stmt, bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); bind[1].buffer_length= 255; - rc = mysql_bind_result(stmt, bind); + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); fprintf(stdout, "\n id : %d", id); fprintf(stdout, "\n name : %s(%ld)", data, length); - assert(id == 9876); + assert(id == 9876); assert(length == 19); /* Due to VARCHAR(20) */ - assert(strcmp(data,"MySQL - Open Source")==0); + assert(strcmp(data, "MySQL - Open Source") == 0); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - + fprintf(stdout, "\n name : %s(%ld)", data, length); assert(length == 1); - assert(strcmp(data,"'")==0); + assert(strcmp(data, "'") == 0); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - + fprintf(stdout, "\n name : %s(%ld)", data, length); assert(length == 1); - assert(strcmp(data,"\"")==0); + assert(strcmp(data, "\"") == 0); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - + fprintf(stdout, "\n name : %s(%ld)", data, length); assert(length == 7); - assert(strcmp(data,"my\'sql\'")==0); + assert(strcmp(data, "my\'sql\'") == 0); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - + fprintf(stdout, "\n name : %s(%ld)", data, length); assert(length == 7); - /*assert(strcmp(data,"my\"sql\"")==0); */ + /*assert(strcmp(data, "my\"sql\"") == 0); */ - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); - rc = mysql_query(mysql,"DROP TABLE test_logs"); + rc= mysql_query(mysql, "DROP TABLE test_logs"); myquery(rc); } -/* - To test 'n' statements create and close -*/ + +/* Test 'n' statements create and close */ static void test_nstmts() { @@ -7340,69 +7157,71 @@ static void test_nstmts() char query[255]; int rc; static uint i, total_stmts= 2000; - long length; MYSQL_BIND bind[1]; myheader("test_nstmts"); - mysql_autocommit(mysql,TRUE); + mysql_autocommit(mysql, TRUE); - rc = mysql_query(mysql, "DROP TABLE IF EXISTS test_nstmts"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_nstmts"); myquery(rc); - - rc = mysql_query(mysql, "CREATE TABLE test_nstmts(id int)"); + + rc= mysql_query(mysql, "CREATE TABLE test_nstmts(id int)"); myquery(rc); + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); + bind[0].buffer= (char *)&i; bind[0].buffer_type= MYSQL_TYPE_LONG; - bind[0].length= 0; - bind[0].is_null= 0; - bind[0].buffer_length= 0; - - for (i=0; i < total_stmts; i++) + + for (i= 0; i < total_stmts; i++) { fprintf(stdout, "\r stmt: %d", i); - - length = (long)(strmov(query, "insert into test_nstmts values(?)")-query); - stmt = mysql_prepare(mysql, query, length); + + strmov(query, "insert into test_nstmts values(?)"); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - rc = mysql_bind_param(stmt, bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); mysql_stmt_close(stmt); } - stmt = mysql_simple_prepare(mysql," select count(*) from test_nstmts"); + stmt= mysql_simple_prepare(mysql, " select count(*) from test_nstmts"); check_stmt(stmt); - rc = mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - i = 0; - rc = mysql_bind_result(stmt, bind); + i= 0; + rc= mysql_stmt_bind_result(stmt, bind); check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); fprintf(stdout, "\n total rows: %d", i); assert( i == total_stmts); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); - - rc = mysql_query(mysql,"DROP TABLE test_nstmts"); + + rc= mysql_query(mysql, "DROP TABLE test_nstmts"); myquery(rc); } -/* - To test stmt seek() functions -*/ + +/* Test stmt seek() functions */ + static void test_fetch_seek() { MYSQL_STMT *stmt; @@ -7414,16 +7233,16 @@ static void test_fetch_seek() myheader("test_fetch_seek"); - rc= mysql_query(mysql,"drop table if exists test_seek"); - myquery(rc); - - rc = mysql_query(mysql, "create table test_seek(c1 int primary key auto_increment, c2 char(10), c3 timestamp(14))"); - myquery(rc); - - rc = mysql_query(mysql, "insert into test_seek(c2) values('venu'),('mysql'),('open'),('source')"); + rc= mysql_query(mysql, "drop table if exists test_seek"); myquery(rc); - stmt = mysql_simple_prepare(mysql,"select * from test_seek"); + rc= mysql_query(mysql, "create table test_seek(c1 int primary key auto_increment, c2 char(10), c3 timestamp(14))"); + myquery(rc); + + rc= mysql_query(mysql, "insert into test_seek(c2) values('venu'), ('mysql'), ('open'), ('source')"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "select * from test_seek"); check_stmt(stmt); bind[0].buffer_type= MYSQL_TYPE_LONG; @@ -7442,61 +7261,61 @@ static void test_fetch_seek() bind[2].buffer= (char *)c3; bind[2].buffer_length= sizeof(c3); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - rc = mysql_bind_result(stmt, bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_result(stmt, bind); + check_execute(stmt, rc); - rc = mysql_stmt_store_result(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_store_result(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout, "\n row 0: %ld,%s,%s", c1,c2,c3); + fprintf(stdout, "\n row 0: %ld, %s, %s", c1, c2, c3); - row = mysql_stmt_row_tell(stmt); + row= mysql_stmt_row_tell(stmt); - row = mysql_stmt_row_seek(stmt, row); + row= mysql_stmt_row_seek(stmt, row); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout, "\n row 2: %ld,%s,%s", c1,c2,c3); + fprintf(stdout, "\n row 2: %ld, %s, %s", c1, c2, c3); - row = mysql_stmt_row_seek(stmt, row); + row= mysql_stmt_row_seek(stmt, row); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout, "\n row 2: %ld,%s,%s", c1,c2,c3); + fprintf(stdout, "\n row 2: %ld, %s, %s", c1, c2, c3); mysql_stmt_data_seek(stmt, 0); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout, "\n row 0: %ld,%s,%s", c1,c2,c3); + fprintf(stdout, "\n row 0: %ld, %s, %s", c1, c2, c3); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } -/* - To test mysql_fetch_column() with offset -*/ + +/* Test mysql_stmt_fetch_column() with offset */ + static void test_fetch_offset() { MYSQL_STMT *stmt; @@ -7509,16 +7328,16 @@ static void test_fetch_offset() myheader("test_fetch_offset"); - rc= mysql_query(mysql,"drop table if exists test_column"); - myquery(rc); - - rc = mysql_query(mysql, "create table test_column(a char(10))"); - myquery(rc); - - rc = mysql_query(mysql, "insert into test_column values('abcdefghij'),(null)"); + rc= mysql_query(mysql, "drop table if exists test_column"); myquery(rc); - stmt = mysql_simple_prepare(mysql,"select * from test_column"); + rc= mysql_query(mysql, "create table test_column(a char(10))"); + myquery(rc); + + rc= mysql_query(mysql, "insert into test_column values('abcdefghij'), (null)"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "select * from test_column"); check_stmt(stmt); bind[0].buffer_type= MYSQL_TYPE_STRING; @@ -7527,58 +7346,59 @@ static void test_fetch_offset() bind[0].is_null= &is_null; bind[0].length= &length; - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - rc = mysql_fetch_column(stmt,bind,0,0); - check_execute_r(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 0, 0); + check_execute_r(stmt, rc); - rc = mysql_bind_result(stmt, bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_result(stmt, bind); + check_execute(stmt, rc); - rc = mysql_stmt_store_result(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_store_result(stmt); + check_execute(stmt, rc); + + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); - data[0]= '\0'; - rc = mysql_fetch_column(stmt,bind,0,0); - check_execute(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 0, 0); + check_execute(stmt, rc); fprintf(stdout, "\n col 1: %s (%ld)", data, length); - assert(strncmp(data,"abcd",4) == 0 && length == 10); - - rc = mysql_fetch_column(stmt,bind,0,5); - check_execute(stmt,rc); - fprintf(stdout, "\n col 1: %s (%ld)", data, length); - assert(strncmp(data,"fg",2) == 0 && length == 10); + assert(strncmp(data, "abcd", 4) == 0 && length == 10); - rc = mysql_fetch_column(stmt,bind,0,9); - check_execute(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 0, 5); + check_execute(stmt, rc); + fprintf(stdout, "\n col 1: %s (%ld)", data, length); + assert(strncmp(data, "fg", 2) == 0 && length == 10); + + rc= mysql_stmt_fetch_column(stmt, bind, 0, 9); + check_execute(stmt, rc); fprintf(stdout, "\n col 0: %s (%ld)", data, length); - assert(strncmp(data,"j",1) == 0 && length == 10); + assert(strncmp(data, "j", 1) == 0 && length == 10); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); is_null= 0; - rc = mysql_fetch_column(stmt,bind,0,0); - check_execute(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 0, 0); + check_execute(stmt, rc); assert(is_null == 1); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); - rc = mysql_fetch_column(stmt,bind,1,0); - check_execute_r(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 1, 0); + check_execute_r(stmt, rc); mysql_stmt_close(stmt); } -/* - To test mysql_fetch_column() -*/ + + +/* Test mysql_stmt_fetch_column() */ + static void test_fetch_column() { MYSQL_STMT *stmt; @@ -7589,16 +7409,16 @@ static void test_fetch_column() myheader("test_fetch_column"); - rc= mysql_query(mysql,"drop table if exists test_column"); - myquery(rc); - - rc = mysql_query(mysql, "create table test_column(c1 int primary key auto_increment, c2 char(10))"); - myquery(rc); - - rc = mysql_query(mysql, "insert into test_column(c2) values('venu'),('mysql')"); + rc= mysql_query(mysql, "drop table if exists test_column"); myquery(rc); - stmt = mysql_simple_prepare(mysql,"select * from test_column order by c2 desc"); + rc= mysql_query(mysql, "create table test_column(c1 int primary key auto_increment, c2 char(10))"); + myquery(rc); + + rc= mysql_query(mysql, "insert into test_column(c2) values('venu'), ('mysql')"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "select * from test_column order by c2 desc"); check_stmt(stmt); bind[0].buffer_type= MYSQL_TYPE_LONG; @@ -7612,22 +7432,22 @@ static void test_fetch_column() bind[1].is_null= 0; bind[1].length= &bl2; - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - rc = mysql_bind_result(stmt, bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_result(stmt, bind); + check_execute(stmt, rc); - rc = mysql_stmt_store_result(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_store_result(stmt); + check_execute(stmt, rc); - rc = mysql_fetch_column(stmt,bind,1,0); /* No-op at this point */ - check_execute_r(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 1, 0); /* No-op at this point */ + check_execute_r(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout, "\n row 0: %d,%s", bc1,bc2); + fprintf(stdout, "\n row 0: %d, %s", bc1, bc2); c2[0]= '\0'; l2= 0; bind[0].buffer_type= MYSQL_TYPE_STRING; @@ -7636,33 +7456,33 @@ static void test_fetch_column() bind[0].is_null= 0; bind[0].length= &l2; - rc = mysql_fetch_column(stmt,bind,1,0); - check_execute(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 1, 0); + check_execute(stmt, rc); fprintf(stdout, "\n col 1: %s(%ld)", c2, l2); - assert(strncmp(c2,"venu",4)==0 && l2 == 4); - - c2[0]= '\0'; l2= 0; - rc = mysql_fetch_column(stmt,bind,1,0); - check_execute(stmt,rc); - fprintf(stdout, "\n col 1: %s(%ld)", c2, l2); - assert(strcmp(c2,"venu")==0 && l2 == 4); + assert(strncmp(c2, "venu", 4) == 0 && l2 == 4); - c1= 0; + c2[0]= '\0'; l2= 0; + rc= mysql_stmt_fetch_column(stmt, bind, 1, 0); + check_execute(stmt, rc); + fprintf(stdout, "\n col 1: %s(%ld)", c2, l2); + assert(strcmp(c2, "venu") == 0 && l2 == 4); + + c1= 0; bind[0].buffer_type= MYSQL_TYPE_LONG; bind[0].buffer= (char *)&c1; bind[0].buffer_length= 0; bind[0].is_null= 0; bind[0].length= &l1; - rc = mysql_fetch_column(stmt,bind,0,0); - check_execute(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 0, 0); + check_execute(stmt, rc); fprintf(stdout, "\n col 0: %d(%ld)", c1, l1); assert(c1 == 1 && l1 == 4); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - fprintf(stdout, "\n row 1: %d,%s", bc1,bc2); + fprintf(stdout, "\n row 1: %d, %s", bc1, bc2); c2[0]= '\0'; l2= 0; bind[0].buffer_type= MYSQL_TYPE_STRING; @@ -7671,136 +7491,136 @@ static void test_fetch_column() bind[0].is_null= 0; bind[0].length= &l2; - rc = mysql_fetch_column(stmt,bind,1,0); - check_execute(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 1, 0); + check_execute(stmt, rc); fprintf(stdout, "\n col 1: %s(%ld)", c2, l2); - assert(strncmp(c2,"mysq",4)==0 && l2 == 5); - - c2[0]= '\0'; l2= 0; - rc = mysql_fetch_column(stmt,bind,1,0); - check_execute(stmt,rc); - fprintf(stdout, "\n col 1: %si(%ld)", c2, l2); - assert(strcmp(c2,"mysql")==0 && l2 == 5); + assert(strncmp(c2, "mysq", 4) == 0 && l2 == 5); - c1= 0; + c2[0]= '\0'; l2= 0; + rc= mysql_stmt_fetch_column(stmt, bind, 1, 0); + check_execute(stmt, rc); + fprintf(stdout, "\n col 1: %si(%ld)", c2, l2); + assert(strcmp(c2, "mysql") == 0 && l2 == 5); + + c1= 0; bind[0].buffer_type= MYSQL_TYPE_LONG; bind[0].buffer= (char *)&c1; bind[0].buffer_length= 0; bind[0].is_null= 0; bind[0].length= &l1; - rc = mysql_fetch_column(stmt,bind,0,0); - check_execute(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 0, 0); + check_execute(stmt, rc); fprintf(stdout, "\n col 0: %d(%ld)", c1, l1); assert(c1 == 2 && l1 == 4); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); - rc = mysql_fetch_column(stmt,bind,1,0); - check_execute_r(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 1, 0); + check_execute_r(stmt, rc); mysql_stmt_close(stmt); } -/* - To test mysql_list_fields() -*/ + +/* Test mysql_list_fields() */ + static void test_list_fields() { MYSQL_RES *result; int rc; myheader("test_list_fields"); - rc= mysql_query(mysql,"drop table if exists test_list_fields"); - myquery(rc); - - rc = mysql_query(mysql, "create table test_list_fields(c1 int primary key auto_increment, c2 char(10) default 'mysql')"); + rc= mysql_query(mysql, "drop table if exists test_list_fields"); myquery(rc); - result = mysql_list_fields(mysql, "test_list_fields",NULL); + rc= mysql_query(mysql, "create table test_list_fields(c1 int primary key auto_increment, c2 char(10) default 'mysql')"); + myquery(rc); + + result= mysql_list_fields(mysql, "test_list_fields", NULL); mytest(result); assert( 0 == my_process_result_set(result)); - - verify_prepare_field(result,0,"c1","c1",MYSQL_TYPE_LONG, - "test_list_fields","test_list_fields",current_db,11,"0"); - - verify_prepare_field(result,1,"c2","c2",MYSQL_TYPE_STRING, - "test_list_fields","test_list_fields",current_db,10,"mysql"); + + verify_prepare_field(result, 0, "c1", "c1", MYSQL_TYPE_LONG, + "test_list_fields", "test_list_fields", current_db, 11, "0"); + + verify_prepare_field(result, 1, "c2", "c2", MYSQL_TYPE_STRING, + "test_list_fields", "test_list_fields", current_db, 10, "mysql"); mysql_free_result(result); } -/* - To test a memory ovverun bug -*/ + +/* Test a memory ovverun bug */ + static void test_mem_overun() { char buffer[10000], field[10]; MYSQL_STMT *stmt; MYSQL_RES *field_res; - int rc,i, length; + int rc, i, length; myheader("test_mem_overun"); /* - Test a memory ovverun bug when a table had 1000 fields with + Test a memory ovverun bug when a table had 1000 fields with a row of data */ - rc= mysql_query(mysql,"drop table if exists t_mem_overun"); + rc= mysql_query(mysql, "drop table if exists t_mem_overun"); myquery(rc); - strxmov(buffer,"create table t_mem_overun(",NullS); - for (i=0; i < 1000; i++) + strxmov(buffer, "create table t_mem_overun(", NullS); + for (i= 0; i < 1000; i++) { - sprintf(field,"c%d int", i); - strxmov(buffer,buffer,field,",",NullS); + sprintf(field, "c%d int", i); + strxmov(buffer, buffer, field, ", ", NullS); } - length= (int)(strmov(buffer,buffer) - buffer); - buffer[length-1]='\0'; - strxmov(buffer,buffer,")",NullS); - - rc = mysql_real_query(mysql, buffer, length); + length= strlen(buffer); + buffer[length-2]= ')'; + buffer[--length]= '\0'; + + rc= mysql_real_query(mysql, buffer, length); myquery(rc); - strxmov(buffer,"insert into t_mem_overun values(",NullS); - for (i=0; i < 1000; i++) + strxmov(buffer, "insert into t_mem_overun values(", NullS); + for (i= 0; i < 1000; i++) { - strxmov(buffer,buffer,"1,",NullS); + strxmov(buffer, buffer, "1, ", NullS); } - length= (int)(strmov(buffer,buffer) - buffer); - buffer[length-1]='\0'; - strxmov(buffer,buffer,")",NullS); - - rc = mysql_real_query(mysql, buffer, length); + length= strlen(buffer); + buffer[length-2]= ')'; + buffer[--length]= '\0'; + + rc= mysql_real_query(mysql, buffer, length); myquery(rc); - rc = mysql_query(mysql,"select * from t_mem_overun"); + rc= mysql_query(mysql, "select * from t_mem_overun"); myquery(rc); assert(1 == my_process_result(mysql)); - - stmt = mysql_simple_prepare(mysql, "select * from t_mem_overun"); + + stmt= mysql_simple_prepare(mysql, "select * from t_mem_overun"); check_stmt(stmt); - rc = mysql_execute(stmt); - check_execute(stmt,rc); - - field_res = mysql_get_metadata(stmt); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + field_res= mysql_stmt_result_metadata(stmt); mytest(field_res); - fprintf(stdout,"\n total fields : %d", mysql_num_fields(field_res)); + fprintf(stdout, "\n total fields : %d", mysql_num_fields(field_res)); assert( 1000 == mysql_num_fields(field_res)); - rc = mysql_stmt_store_result(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_store_result(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); mysql_free_result(field_res); @@ -7808,9 +7628,9 @@ static void test_mem_overun() mysql_stmt_close(stmt); } -/* - To test mysql_stmt_free_result() -*/ + +/* Test mysql_stmt_free_result() */ + static void test_free_result() { MYSQL_STMT *stmt; @@ -7821,16 +7641,17 @@ static void test_free_result() myheader("test_free_result"); - rc= mysql_query(mysql,"drop table if exists test_free_result"); - myquery(rc); - - rc = mysql_query(mysql, "create table test_free_result(c1 int primary key auto_increment)"); - myquery(rc); - - rc = mysql_query(mysql, "insert into test_free_result values(),(),()"); + rc= mysql_query(mysql, "drop table if exists test_free_result"); myquery(rc); - stmt = mysql_simple_prepare(mysql,"select * from test_free_result"); + rc= mysql_query(mysql, "create table test_free_result(" + "c1 int primary key auto_increment)"); + myquery(rc); + + rc= mysql_query(mysql, "insert into test_free_result values(), (), ()"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "select * from test_free_result"); check_stmt(stmt); bind[0].buffer_type= MYSQL_TYPE_LONG; @@ -7839,14 +7660,14 @@ static void test_free_result() bind[0].is_null= 0; bind[0].length= &bl1; - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - rc = mysql_bind_result(stmt, bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_result(stmt, bind); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); c2[0]= '\0'; l2= 0; bind[0].buffer_type= MYSQL_TYPE_STRING; @@ -7855,41 +7676,41 @@ static void test_free_result() bind[0].is_null= 0; bind[0].length= &l2; - rc = mysql_fetch_column(stmt,bind,0,0); - check_execute(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 0, 0); + check_execute(stmt, rc); fprintf(stdout, "\n col 0: %s(%ld)", c2, l2); - assert(strncmp(c2,"1",1)==0 && l2 == 1); + assert(strncmp(c2, "1", 1) == 0 && l2 == 1); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - c1= 0, l2= 0; + c1= 0, l2= 0; bind[0].buffer_type= MYSQL_TYPE_LONG; bind[0].buffer= (char *)&c1; bind[0].buffer_length= 0; bind[0].is_null= 0; bind[0].length= &l2; - rc = mysql_fetch_column(stmt,bind,0,0); - check_execute(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 0, 0); + check_execute(stmt, rc); fprintf(stdout, "\n col 0: %d(%ld)", c1, l2); - assert(c1 == 2 && l2 == 4); + assert(c1 == 2 && l2 == 4); - rc = mysql_query(mysql,"drop table test_free_result"); + rc= mysql_query(mysql, "drop table test_free_result"); myquery_r(rc); /* error should be, COMMANDS OUT OF SYNC */ - rc = mysql_stmt_free_result(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_free_result(stmt); + check_execute(stmt, rc); - rc = mysql_query(mysql,"drop table test_free_result"); + rc= mysql_query(mysql, "drop table test_free_result"); myquery(rc); /* should be successful */ mysql_stmt_close(stmt); } -/* - To test mysql_stmt_free_result() -*/ + +/* Test mysql_stmt_store_result() */ + static void test_free_store_result() { MYSQL_STMT *stmt; @@ -7900,16 +7721,16 @@ static void test_free_store_result() myheader("test_free_store_result"); - rc= mysql_query(mysql,"drop table if exists test_free_result"); - myquery(rc); - - rc = mysql_query(mysql, "create table test_free_result(c1 int primary key auto_increment)"); - myquery(rc); - - rc = mysql_query(mysql, "insert into test_free_result values(),(),()"); + rc= mysql_query(mysql, "drop table if exists test_free_result"); myquery(rc); - stmt = mysql_simple_prepare(mysql,"select * from test_free_result"); + rc= mysql_query(mysql, "create table test_free_result(c1 int primary key auto_increment)"); + myquery(rc); + + rc= mysql_query(mysql, "insert into test_free_result values(), (), ()"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "select * from test_free_result"); check_stmt(stmt); bind[0].buffer_type= MYSQL_TYPE_LONG; @@ -7918,17 +7739,17 @@ static void test_free_store_result() bind[0].is_null= 0; bind[0].length= &bl1; - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - rc = mysql_bind_result(stmt, bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_result(stmt, bind); + check_execute(stmt, rc); - rc = mysql_stmt_store_result(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_store_result(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); c2[0]= '\0'; l2= 0; bind[0].buffer_type= MYSQL_TYPE_STRING; @@ -7937,38 +7758,37 @@ static void test_free_store_result() bind[0].is_null= 0; bind[0].length= &l2; - rc = mysql_fetch_column(stmt,bind,0,0); - check_execute(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 0, 0); + check_execute(stmt, rc); fprintf(stdout, "\n col 1: %s(%ld)", c2, l2); - assert(strncmp(c2,"1",1)==0 && l2 == 1); + assert(strncmp(c2, "1", 1) == 0 && l2 == 1); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - c1= 0, l2= 0; + c1= 0, l2= 0; bind[0].buffer_type= MYSQL_TYPE_LONG; bind[0].buffer= (char *)&c1; bind[0].buffer_length= 0; bind[0].is_null= 0; bind[0].length= &l2; - rc = mysql_fetch_column(stmt,bind,0,0); - check_execute(stmt,rc); + rc= mysql_stmt_fetch_column(stmt, bind, 0, 0); + check_execute(stmt, rc); fprintf(stdout, "\n col 0: %d(%ld)", c1, l2); assert(c1 == 2 && l2 == 4); - rc = mysql_stmt_free_result(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_free_result(stmt); + check_execute(stmt, rc); - rc = mysql_query(mysql,"drop table test_free_result"); - myquery(rc); + rc= mysql_query(mysql, "drop table test_free_result"); + myquery(rc); mysql_stmt_close(stmt); } -/******************************************************** - To test SQLmode -*********************************************************/ + +/* Test SQLmode */ static void test_sqlmode() { @@ -7979,125 +7799,124 @@ static void test_sqlmode() myheader("test_sqlmode"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_piping"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_piping"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_piping(name varchar(10))"); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_piping(name varchar(10))"); - myquery(rc); - /* PIPES_AS_CONCAT */ - strcpy(query,"SET SQL_MODE=\"PIPES_AS_CONCAT\""); - fprintf(stdout,"\n With %s", query); - rc = mysql_query(mysql,query); + strcpy(query, "SET SQL_MODE= \"PIPES_AS_CONCAT\""); + fprintf(stdout, "\n With %s", query); + rc= mysql_query(mysql, query); myquery(rc); strcpy(query, "INSERT INTO test_piping VALUES(?||?)"); - fprintf(stdout,"\n query: %s", query); - stmt = mysql_simple_prepare(mysql, query); + fprintf(stdout, "\n query: %s", query); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - fprintf(stdout,"\n total parameters: %ld", mysql_param_count(stmt)); + fprintf(stdout, "\n total parameters: %ld", mysql_stmt_param_count(stmt)); + + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].buffer= (char *)c1; bind[0].buffer_length= 2; - bind[0].is_null= 0; - bind[0].length= 0; bind[1].buffer_type= MYSQL_TYPE_STRING; bind[1].buffer= (char *)c2; bind[1].buffer_length= 3; - bind[1].is_null= 0; - bind[1].length= 0; - rc = mysql_bind_param(stmt, bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); - strcpy(c1,"My"); strcpy(c2, "SQL"); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + strcpy(c1, "My"); strcpy(c2, "SQL"); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); mysql_stmt_close(stmt); - verify_col_data("test_piping","name","MySQL"); + verify_col_data("test_piping", "name", "MySQL"); - rc = mysql_query(mysql,"DELETE FROM test_piping"); + rc= mysql_query(mysql, "DELETE FROM test_piping"); myquery(rc); - + strcpy(query, "SELECT connection_id ()"); - fprintf(stdout,"\n query: %s", query); - stmt = mysql_simple_prepare(mysql, query); + fprintf(stdout, "\n query: %s", query); + stmt= mysql_simple_prepare(mysql, query); check_stmt_r(stmt); /* ANSI */ - strcpy(query,"SET SQL_MODE=\"ANSI\""); - fprintf(stdout,"\n With %s", query); - rc = mysql_query(mysql,query); + strcpy(query, "SET SQL_MODE= \"ANSI\""); + fprintf(stdout, "\n With %s", query); + rc= mysql_query(mysql, query); myquery(rc); strcpy(query, "INSERT INTO test_piping VALUES(?||?)"); - fprintf(stdout,"\n query: %s", query); - stmt = mysql_simple_prepare(mysql, query); + fprintf(stdout, "\n query: %s", query); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - fprintf(stdout,"\n total parameters: %ld", mysql_param_count(stmt)); + fprintf(stdout, "\n total parameters: %ld", mysql_stmt_param_count(stmt)); - rc = mysql_bind_param(stmt, bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); - strcpy(c1,"My"); strcpy(c2, "SQL"); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + strcpy(c1, "My"); strcpy(c2, "SQL"); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); mysql_stmt_close(stmt); - verify_col_data("test_piping","name","MySQL"); + verify_col_data("test_piping", "name", "MySQL"); /* ANSI mode spaces ... */ strcpy(query, "SELECT connection_id ()"); - fprintf(stdout,"\n query: %s", query); - stmt = mysql_simple_prepare(mysql, query); + fprintf(stdout, "\n query: %s", query); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); - fprintf(stdout,"\n returned 1 row\n"); + fprintf(stdout, "\n returned 1 row\n"); mysql_stmt_close(stmt); - + /* IGNORE SPACE MODE */ - strcpy(query,"SET SQL_MODE=\"IGNORE_SPACE\""); - fprintf(stdout,"\n With %s", query); - rc = mysql_query(mysql,query); + strcpy(query, "SET SQL_MODE= \"IGNORE_SPACE\""); + fprintf(stdout, "\n With %s", query); + rc= mysql_query(mysql, query); myquery(rc); strcpy(query, "SELECT connection_id ()"); - fprintf(stdout,"\n query: %s", query); - stmt = mysql_simple_prepare(mysql, query); + fprintf(stdout, "\n query: %s", query); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); - fprintf(stdout,"\n returned 1 row"); + fprintf(stdout, "\n returned 1 row"); mysql_stmt_close(stmt); } -/* - test for timestamp handling -*/ + +/* Test for timestamp handling */ + static void test_ts() { MYSQL_STMT *stmt; @@ -8111,16 +7930,13 @@ static void test_ts() myheader("test_ts"); - rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_ts"); - myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_ts(a DATE, b TIME, c TIMESTAMP)"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_ts"); myquery(rc); - rc = mysql_commit(mysql); + rc= mysql_query(mysql, "CREATE TABLE test_ts(a DATE, b TIME, c TIMESTAMP)"); myquery(rc); - stmt = mysql_simple_prepare(mysql,"INSERT INTO test_ts VALUES(?,?,?),(?,?,?)"); + stmt= mysql_simple_prepare(mysql, "INSERT INTO test_ts VALUES(?, ?, ?), (?, ?, ?)"); check_stmt(stmt); ts.year= 2003; @@ -8130,46 +7946,49 @@ static void test_ts() ts.minute= 07; ts.second= 46; ts.second_part= 0; - length= (long)(strmov(strts,"2003-07-12 21:07:46") - strts); + length= (long)(strmov(strts, "2003-07-12 21:07:46") - strts); + + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); bind[0].buffer_type= MYSQL_TYPE_TIMESTAMP; bind[0].buffer= (char *)&ts; bind[0].buffer_length= sizeof(ts); - bind[0].is_null= 0; - bind[0].length= 0; bind[2]= bind[1]= bind[0]; bind[3].buffer_type= MYSQL_TYPE_STRING; bind[3].buffer= (char *)strts; bind[3].buffer_length= sizeof(strts); - bind[3].is_null= 0; bind[3].length= &length; bind[5]= bind[4]= bind[3]; - rc = mysql_bind_param(stmt, bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); mysql_stmt_close(stmt); - verify_col_data("test_ts","a","2003-07-12"); - verify_col_data("test_ts","b","21:07:46"); - verify_col_data("test_ts","c","2003-07-12 21:07:46"); + verify_col_data("test_ts", "a", "2003-07-12"); + verify_col_data("test_ts", "b", "21:07:46"); + verify_col_data("test_ts", "c", "2003-07-12 21:07:46"); - stmt = mysql_simple_prepare(mysql,"SELECT * FROM test_ts"); + stmt= mysql_simple_prepare(mysql, "SELECT * FROM test_ts"); check_stmt(stmt); - prep_res = mysql_get_metadata(stmt); + prep_res= mysql_stmt_result_metadata(stmt); mytest(prep_res); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - assert( 2== my_process_stmt_result(stmt)); + assert(2 == my_process_stmt_result(stmt)); field_count= mysql_num_fields(prep_res); mysql_free_result(prep_res); @@ -8179,20 +7998,19 @@ static void test_ts() { int row_count= 0; - sprintf(query,"SELECT a,b,c FROM test_ts WHERE %c=?",name); - length= (long)(strmov(query,query)- query); + sprintf(query, "SELECT a, b, c FROM test_ts WHERE %c=?", name); - fprintf(stdout,"\n %s", query); - stmt = mysql_prepare(mysql, query, length); + fprintf(stdout, "\n %s", query); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - rc = mysql_bind_param(stmt, bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - while (mysql_fetch(stmt) == 0) + while (mysql_stmt_fetch(stmt) == 0) row_count++; fprintf(stdout, "\n returned '%d' rows", row_count); @@ -8201,63 +8019,65 @@ static void test_ts() } } -/* - Test for bug #1500. -*/ + +/* Test for bug #1500. */ static void test_bug1500() { MYSQL_STMT *stmt; MYSQL_BIND bind[3]; int rc; - long int_data[3]= {2,3,4}; + long int_data[3]= {2, 3, 4}; const char *data; myheader("test_bug1500"); - rc= mysql_query(mysql,"DROP TABLE IF EXISTS test_bg1500"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bg1500"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_bg1500 (i INT)"); + + rc= mysql_query(mysql, "CREATE TABLE test_bg1500 (i INT)"); myquery(rc); - - rc= mysql_query(mysql,"INSERT INTO test_bg1500 VALUES (1),(2)"); + + rc= mysql_query(mysql, "INSERT INTO test_bg1500 VALUES (1), (2)"); myquery(rc); rc= mysql_commit(mysql); myquery(rc); - stmt= mysql_simple_prepare(mysql,"SELECT i FROM test_bg1500 WHERE i IN (?,?,?)"); + stmt= mysql_simple_prepare(mysql, "SELECT i FROM test_bg1500 WHERE i IN (?, ?, ?)"); check_stmt(stmt); - verify_param_count(stmt,3); + verify_param_count(stmt, 3); + + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); bind[0].buffer= (char *)int_data; - bind[0].buffer_type= FIELD_TYPE_LONG; - bind[0].is_null= 0; - bind[0].length= NULL; - bind[0].buffer_length= 0; + bind[0].buffer_type= MYSQL_TYPE_LONG; bind[2]= bind[1]= bind[0]; bind[1].buffer= (char *)(int_data + 1); bind[2].buffer= (char *)(int_data + 2); - - rc= mysql_bind_param(stmt, bind); - check_execute(stmt,rc); - - rc= mysql_execute(stmt); - check_execute(stmt,rc); - + + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + assert(1 == my_process_stmt_result(stmt)); mysql_stmt_close(stmt); - rc= mysql_query(mysql,"DROP TABLE test_bg1500"); + rc= mysql_query(mysql, "DROP TABLE test_bg1500"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_bg1500 (s VARCHAR(25), FULLTEXT(s))"); + + rc= mysql_query(mysql, "CREATE TABLE test_bg1500 (s VARCHAR(25), FULLTEXT(s))"); myquery(rc); - + rc= mysql_query(mysql, - "INSERT INTO test_bg1500 VALUES ('Gravedigger'), ('Greed'),('Hollow Dogs')"); + "INSERT INTO test_bg1500 VALUES ('Gravedigger'), ('Greed'), ('Hollow Dogs')"); myquery(rc); rc= mysql_commit(mysql); @@ -8266,55 +8086,54 @@ static void test_bug1500() stmt= mysql_simple_prepare(mysql, "SELECT s FROM test_bg1500 WHERE MATCH (s) AGAINST (?)"); check_stmt(stmt); - - verify_param_count(stmt,1); - + + verify_param_count(stmt, 1); + data= "Dogs"; bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].buffer= (char *) data; bind[0].buffer_length= strlen(data); bind[0].is_null= 0; bind[0].length= 0; - - rc= mysql_bind_param(stmt, bind); - check_execute(stmt,rc); - - rc= mysql_execute(stmt); - check_execute(stmt,rc); - + + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + assert(1 == my_process_stmt_result(stmt)); - /* - FIXME If we comment out next string server will crash too :( + /* + FIXME If we comment out next string server will crash too :( This is another manifestation of bug #1663 */ mysql_stmt_close(stmt); - + /* This should work too */ stmt= mysql_simple_prepare(mysql, - "SELECT s FROM test_bg1500 WHERE MATCH (s) AGAINST (CONCAT(?,'digger'))"); + "SELECT s FROM test_bg1500 WHERE MATCH (s) AGAINST (CONCAT(?, 'digger'))"); check_stmt(stmt); - - verify_param_count(stmt,1); - + + verify_param_count(stmt, 1); + data= "Grave"; bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].buffer= (char *) data; bind[0].buffer_length= strlen(data); - bind[0].is_null= 0; - bind[0].length= 0; - - rc= mysql_bind_param(stmt, bind); - check_execute(stmt,rc); - - rc= mysql_execute(stmt); - check_execute(stmt,rc); - + + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + assert(1 == my_process_stmt_result(stmt)); mysql_stmt_close(stmt); } + static void test_bug1946() { MYSQL_STMT *stmt; @@ -8322,14 +8141,14 @@ static void test_bug1946() const char *query= "INSERT INTO prepare_command VALUES (?)"; myheader("test_bug1946"); - - rc = mysql_query(mysql, "DROP TABLE IF EXISTS prepare_command"); - myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE prepare_command(ID INT)"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS prepare_command"); myquery(rc); - stmt = mysql_simple_prepare(mysql, query); + rc= mysql_query(mysql, "CREATE TABLE prepare_command(ID INT)"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); rc= mysql_real_query(mysql, query, strlen(query)); assert(rc != 0); @@ -8337,9 +8156,10 @@ static void test_bug1946() myerror(NULL); mysql_stmt_close(stmt); - rc= mysql_query(mysql,"DROP TABLE prepare_command"); + rc= mysql_query(mysql, "DROP TABLE prepare_command"); } + static void test_parse_error_and_bad_length() { MYSQL_STMT *stmt; @@ -8348,19 +8168,21 @@ static void test_parse_error_and_bad_length() /* check that we get 4 syntax errors over the 4 calls */ myheader("test_parse_error_and_bad_length"); - rc= mysql_query(mysql,"SHOW DATABAAAA"); + rc= mysql_query(mysql, "SHOW DATABAAAA"); assert(rc); fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql)); - rc= mysql_real_query(mysql,"SHOW DATABASES",100); + rc= mysql_real_query(mysql, "SHOW DATABASES", 100); assert(rc); fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql)); - stmt= mysql_simple_prepare(mysql,"SHOW DATABAAAA"); - assert(!stmt); - fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql)); - stmt= mysql_prepare(mysql,"SHOW DATABASES",100); + stmt= mysql_simple_prepare(mysql, "SHOW DATABAAAA"); assert(!stmt); fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql)); + stmt= mysql_stmt_init(mysql); + assert(stmt); + assert(mysql_stmt_prepare(stmt, "SHOW DATABASES", 100) != 0); + fprintf(stdout, "Got error (as expected): '%s'\n", mysql_stmt_error(stmt)); + mysql_stmt_close(stmt); } @@ -8379,21 +8201,21 @@ static void test_bug2247() enum { NUM_ROWS= 5 }; myheader("test_bug2247"); - + fprintf(stdout, "\nChecking if stmt_affected_rows is not affected by\n" "mysql_query ... "); /* create table and insert few rows */ - rc = mysql_query(mysql, drop); + rc= mysql_query(mysql, drop); myquery(rc); - + rc= mysql_query(mysql, create); myquery(rc); - stmt= mysql_prepare(mysql, insert, strlen(insert)); + stmt= mysql_simple_prepare(mysql, insert); check_stmt(stmt); for (i= 0; i < NUM_ROWS; ++i) { - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); } exp_count= mysql_stmt_affected_rows(stmt); @@ -8401,7 +8223,7 @@ static void test_bug2247() rc= mysql_query(mysql, select); myquery(rc); - /* + /* mysql_store_result overwrites mysql->affected_rows. Check that mysql_stmt_affected_rows() returns the same value, whereas mysql_affected_rows() value is correct. @@ -8411,7 +8233,7 @@ static void test_bug2247() assert(mysql_affected_rows(mysql) == NUM_ROWS); assert(exp_count == mysql_stmt_affected_rows(stmt)); - + rc= mysql_query(mysql, update); myquery(rc); assert(mysql_affected_rows(mysql) == NUM_ROWS); @@ -8421,10 +8243,10 @@ static void test_bug2247() mysql_stmt_close(stmt); /* check that mysql_stmt_store_result modifies mysql_stmt_affected_rows */ - stmt= mysql_prepare(mysql, select, strlen(select)); + stmt= mysql_simple_prepare(mysql, select); check_stmt(stmt); - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); rc= mysql_stmt_store_result(stmt); check_execute(stmt, rc); @@ -8435,7 +8257,7 @@ static void test_bug2247() myquery(rc); assert(mysql_affected_rows(mysql) == 1); assert(mysql_stmt_affected_rows(stmt) == exp_count); - + mysql_stmt_close(stmt); fprintf(stdout, "OK"); } @@ -8445,34 +8267,34 @@ static void test_subqueries() { MYSQL_STMT *stmt; int rc, i; - const char *query= "SELECT (SELECT SUM(a+b) FROM t2 where t1.b=t2.b GROUP BY t1.a LIMIT 1) as scalar_s, exists (select 1 from t2 where t2.a/2=t1.a) as exists_s, a in (select a+3 from t2) as in_s, (a-1,b-1) in (select a,b from t2) as in_row_s FROM t1, (select a x, b y from t2) tt WHERE x=a"; + const char *query= "SELECT (SELECT SUM(a+b) FROM t2 where t1.b=t2.b GROUP BY t1.a LIMIT 1) as scalar_s, exists (select 1 from t2 where t2.a/2=t1.a) as exists_s, a in (select a+3 from t2) as in_s, (a-1, b-1) in (select a, b from t2) as in_row_s FROM t1, (select a x, b y from t2) tt WHERE x=a"; myheader("test_subquery"); - - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1,t2"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1, t2"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE t1 (a int , b int);"); + + rc= mysql_query(mysql, "CREATE TABLE t1 (a int , b int);"); myquery(rc); rc= mysql_query(mysql, - "insert into t1 values (1,1), (2, 2), (3,3), (4,4), (5,5);"); + "insert into t1 values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);"); myquery(rc); - rc= mysql_query(mysql,"create table t2 select * from t1;"); + rc= mysql_query(mysql, "create table t2 select * from t1;"); myquery(rc); - stmt= mysql_prepare(mysql, query, strlen(query)); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); for (i= 0; i < 3; i++) { - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(5 == my_process_stmt_result(stmt)); } mysql_stmt_close(stmt); - rc= mysql_query(mysql, "DROP TABLE t1,t2"); + rc= mysql_query(mysql, "DROP TABLE t1, t2"); myquery(rc); } @@ -8483,37 +8305,38 @@ static void test_bad_union() const char *query= "SELECT 1, 2 union SELECT 1"; myheader("test_bad_union"); - - stmt= mysql_prepare(mysql, query, strlen(query)); + + stmt= mysql_simple_prepare(mysql, query); assert(stmt == 0); - myerror(NULL); + myerror(NULL); } + static void test_distinct() { MYSQL_STMT *stmt; int rc, i; - const char *query= + const char *query= "SELECT 2+count(distinct b), group_concat(a) FROM t1 group by a"; myheader("test_subquery"); - - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE t1 (a int , b int);"); + + rc= mysql_query(mysql, "CREATE TABLE t1 (a int , b int);"); myquery(rc); rc= mysql_query(mysql, - "insert into t1 values (1,1), (2, 2), (3,3), (4,4), (5,5),\ -(1,10), (2, 20), (3,30), (4,40), (5,50);"); + "insert into t1 values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), \ +(1, 10), (2, 20), (3, 30), (4, 40), (5, 50);"); myquery(rc); for (i= 0; i < 3; i++) { - stmt= mysql_prepare(mysql, query, strlen(query)); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(5 == my_process_stmt_result(stmt)); mysql_stmt_close(stmt); @@ -8523,8 +8346,9 @@ static void test_distinct() myquery(rc); } + /* - Test for bug#2248 "mysql_fetch without prior mysql_execute hangs" + Test for bug#2248 "mysql_fetch without prior mysql_stmt_execute hangs" */ static void test_bug2248() @@ -8533,53 +8357,54 @@ static void test_bug2248() int rc; const char *query1= "SELECT DATABASE()"; const char *query2= "INSERT INTO test_bug2248 VALUES (10)"; - + myheader("test_bug2248"); rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bug2248"); myquery(rc); - + rc= mysql_query(mysql, "CREATE TABLE test_bug2248 (id int)"); myquery(rc); - - stmt= mysql_prepare(mysql, query1, strlen(query1)); + + stmt= mysql_simple_prepare(mysql, query1); check_stmt(stmt); /* This should not hang */ - rc= mysql_fetch(stmt); - check_execute_r(stmt,rc); - + rc= mysql_stmt_fetch(stmt); + check_execute_r(stmt, rc); + /* And this too */ rc= mysql_stmt_store_result(stmt); - check_execute_r(stmt,rc); - + check_execute_r(stmt, rc); + mysql_stmt_close(stmt); - - stmt= mysql_prepare(mysql, query2, strlen(query2)); + + stmt= mysql_simple_prepare(mysql, query2); check_stmt(stmt); - - rc= mysql_execute(stmt); - check_execute(stmt,rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); /* This too should not hang but should return proper error */ - rc= mysql_fetch(stmt); - assert(rc==MYSQL_NO_DATA); - + rc= mysql_stmt_fetch(stmt); + assert(rc == MYSQL_NO_DATA); + /* This too should not hang but should not bark */ rc= mysql_stmt_store_result(stmt); - check_execute(stmt,rc); - + check_execute(stmt, rc); + /* This should return proper error */ - rc= mysql_fetch(stmt); - check_execute_r(stmt,rc); - assert(rc==MYSQL_NO_DATA); - + rc= mysql_stmt_fetch(stmt); + check_execute_r(stmt, rc); + assert(rc == MYSQL_NO_DATA); + mysql_stmt_close(stmt); - - rc= mysql_query(mysql,"DROP TABLE test_bug2248"); + + rc= mysql_query(mysql, "DROP TABLE test_bug2248"); myquery(rc); } + static void test_subqueries_ref() { MYSQL_STMT *stmt; @@ -8587,22 +8412,22 @@ static void test_subqueries_ref() const char *query= "SELECT a as ccc from t1 where a+1=(SELECT 1+ccc from t1 where ccc+1=a+1 and a=1)"; myheader("test_subquery_ref"); - - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE t1 (a int);"); + + rc= mysql_query(mysql, "CREATE TABLE t1 (a int);"); myquery(rc); rc= mysql_query(mysql, - "insert into t1 values (1), (2), (3), (4), (5);"); + "insert into t1 values (1), (2), (3), (4), (5);"); myquery(rc); - stmt= mysql_prepare(mysql, query, strlen(query)); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); for (i= 0; i < 3; i++) { - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(1 == my_process_stmt_result(stmt)); } @@ -8619,7 +8444,7 @@ static void test_union() int rc; myheader("test_union"); - + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1, t2"); myquery(rc); @@ -8649,14 +8474,14 @@ static void test_union() "(10, 'Azerbaijan'), (11, 'Afghanistan'), " "(12, 'Burkina Faso'), (13, 'Faroe Islands')"); myquery(rc); - + stmt= mysql_simple_prepare(mysql, "SELECT t1.name FROM t1 UNION " "SELECT t2.name FROM t2"); check_stmt(stmt); rc= mysql_stmt_execute(stmt); - check_execute(stmt,rc); + check_execute(stmt, rc); assert(20 == my_process_stmt_result(stmt)); mysql_stmt_close(stmt); @@ -8664,6 +8489,7 @@ static void test_union() myquery(rc); } + static void test_bug3117() { MYSQL_STMT *stmt; @@ -8674,51 +8500,52 @@ static void test_bug3117() int rc; myheader("test_bug3117"); - - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1"); - myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE t1 (id int auto_increment primary key)"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); myquery(rc); - stmt = mysql_simple_prepare(mysql, "SELECT LAST_INSERT_ID()"); + rc= mysql_query(mysql, "CREATE TABLE t1 (id int auto_increment primary key)"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "SELECT LAST_INSERT_ID()"); check_stmt(stmt); rc= mysql_query(mysql, "INSERT INTO t1 VALUES (NULL)"); myquery(rc); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + bzero((char*) &buffer, sizeof(buffer)); buffer.buffer_type= MYSQL_TYPE_LONGLONG; buffer.buffer_length= sizeof(lii); buffer.buffer= (char *)&lii; buffer.length= &length; buffer.is_null= &is_null; - rc= mysql_bind_result(stmt, &buffer); - check_execute(stmt,rc); + rc= mysql_stmt_bind_result(stmt, &buffer); + check_execute(stmt, rc); rc= mysql_stmt_store_result(stmt); - check_execute(stmt,rc); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); assert(is_null == 0 && lii == 1); - fprintf(stdout, "\n\tLAST_INSERT_ID() = 1 ok\n"); + fprintf(stdout, "\n\tLAST_INSERT_ID()= 1 ok\n"); rc= mysql_query(mysql, "INSERT INTO t1 VALUES (NULL)"); myquery(rc); - rc = mysql_execute(stmt); - check_execute(stmt,rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); - rc = mysql_fetch(stmt); + rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); assert(is_null == 0 && lii == 2); - fprintf(stdout, "\tLAST_INSERT_ID() = 2 ok\n"); + fprintf(stdout, "\tLAST_INSERT_ID()= 2 ok\n"); mysql_stmt_close(stmt); @@ -8731,49 +8558,49 @@ static void test_join() { MYSQL_STMT *stmt; int rc, i, j; - const char *query[]={"SELECT * FROM t2 join t1 on (t1.a=t2.a)", - "SELECT * FROM t2 natural join t1", - "SELECT * FROM t2 join t1 using(a)", - "SELECT * FROM t2 left join t1 on(t1.a=t2.a)", - "SELECT * FROM t2 natural left join t1", - "SELECT * FROM t2 left join t1 using(a)", - "SELECT * FROM t2 right join t1 on(t1.a=t2.a)", - "SELECT * FROM t2 natural right join t1", - "SELECT * FROM t2 right join t1 using(a)"}; + const char *query[]= {"SELECT * FROM t2 join t1 on (t1.a=t2.a)", + "SELECT * FROM t2 natural join t1", + "SELECT * FROM t2 join t1 using(a)", + "SELECT * FROM t2 left join t1 on(t1.a=t2.a)", + "SELECT * FROM t2 natural left join t1", + "SELECT * FROM t2 left join t1 using(a)", + "SELECT * FROM t2 right join t1 on(t1.a=t2.a)", + "SELECT * FROM t2 natural right join t1", + "SELECT * FROM t2 right join t1 using(a)"}; myheader("test_join"); - - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1,t2"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1, t2"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE t1 (a int , b int);"); + + rc= mysql_query(mysql, "CREATE TABLE t1 (a int , b int);"); myquery(rc); rc= mysql_query(mysql, - "insert into t1 values (1,1), (2, 2), (3,3), (4,4), (5,5);"); + "insert into t1 values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);"); myquery(rc); - rc= mysql_query(mysql,"CREATE TABLE t2 (a int , c int);"); + rc= mysql_query(mysql, "CREATE TABLE t2 (a int , c int);"); myquery(rc); rc= mysql_query(mysql, - "insert into t2 values (1,1), (2, 2), (3,3), (4,4), (5,5);"); + "insert into t2 values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);"); myquery(rc); for (j= 0; j < 9; j++) { - stmt= mysql_prepare(mysql, query[j], strlen(query[j])); + stmt= mysql_simple_prepare(mysql, query[j]); check_stmt(stmt); for (i= 0; i < 3; i++) { - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(5 == my_process_stmt_result(stmt)); } mysql_stmt_close(stmt); } - rc= mysql_query(mysql, "DROP TABLE t1,t2"); + rc= mysql_query(mysql, "DROP TABLE t1, t2"); myquery(rc); } @@ -8782,44 +8609,44 @@ static void test_selecttmp() { MYSQL_STMT *stmt; int rc, i; - const char *query= "select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3"; + const char *query= "select a, (select count(distinct t1.b) as sum from t1, t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3"; myheader("test_select_tmp"); - - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1,t2,t3"); - myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE t1 (a int , b int);"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1, t2, t3"); myquery(rc); - rc= mysql_query(mysql,"create table t2 (a int, b int);"); + rc= mysql_query(mysql, "CREATE TABLE t1 (a int , b int);"); myquery(rc); - rc= mysql_query(mysql,"create table t3 (a int, b int);"); + rc= mysql_query(mysql, "create table t2 (a int, b int);"); + myquery(rc); + + rc= mysql_query(mysql, "create table t3 (a int, b int);"); myquery(rc); rc= mysql_query(mysql, - "insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), \ -(2,-1), (3,10);"); + "insert into t1 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7), \ +(2, -1), (3, 10);"); myquery(rc); rc= mysql_query(mysql, - "insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);"); + "insert into t2 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1);"); myquery(rc); rc= mysql_query(mysql, - "insert into t3 values (3,3), (2,2), (1,1);"); + "insert into t3 values (3, 3), (2, 2), (1, 1);"); myquery(rc); - stmt= mysql_prepare(mysql, query, strlen(query)); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); for (i= 0; i < 3; i++) { - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(3 == my_process_stmt_result(stmt)); } mysql_stmt_close(stmt); - rc= mysql_query(mysql, "DROP TABLE t1,t2,t3"); + rc= mysql_query(mysql, "DROP TABLE t1, t2, t3"); myquery(rc); } @@ -8830,65 +8657,65 @@ static void test_create_drop() char *query; int rc, i; myheader("test_table_manipulation"); - - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1,t2"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1, t2"); myquery(rc); - rc= mysql_query(mysql,"create table t2 (a int);"); + rc= mysql_query(mysql, "create table t2 (a int);"); myquery(rc); - rc= mysql_query(mysql,"create table t1 (a int);"); + rc= mysql_query(mysql, "create table t1 (a int);"); myquery(rc); rc= mysql_query(mysql, "insert into t2 values (3), (2), (1);"); myquery(rc); - + query= (char*)"create table t1 (a int)"; - stmt_create= mysql_prepare(mysql, query, strlen(query)); + stmt_create= mysql_simple_prepare(mysql, query); check_stmt(stmt_create); query= (char*)"drop table t1"; - stmt_drop= mysql_prepare(mysql, query, strlen(query)); + stmt_drop= mysql_simple_prepare(mysql, query); check_stmt(stmt_drop); query= (char*)"select a in (select a from t2) from t1"; - stmt_select= mysql_prepare(mysql, query, strlen(query)); + stmt_select= mysql_simple_prepare(mysql, query); check_stmt(stmt_select); - + rc= mysql_query(mysql, "DROP TABLE t1"); myquery(rc); query= (char*)"create table t1 select a from t2"; - stmt_create_select= mysql_prepare(mysql, query, strlen(query)); + stmt_create_select= mysql_simple_prepare(mysql, query); check_stmt(stmt_create_select); for (i= 0; i < 3; i++) { - rc= mysql_execute(stmt_create); + rc= mysql_stmt_execute(stmt_create); check_execute(stmt_create, rc); fprintf(stdout, "created %i\n", i); - rc= mysql_execute(stmt_select); + rc= mysql_stmt_execute(stmt_select); check_execute(stmt_select, rc); assert(0 == my_process_stmt_result(stmt_select)); - rc= mysql_execute(stmt_drop); + rc= mysql_stmt_execute(stmt_drop); check_execute(stmt_drop, rc); fprintf(stdout, "droped %i\n", i); - rc= mysql_execute(stmt_create_select); + rc= mysql_stmt_execute(stmt_create_select); check_execute(stmt_create, rc); fprintf(stdout, "created select %i\n", i); - rc= mysql_execute(stmt_select); + rc= mysql_stmt_execute(stmt_select); check_execute(stmt_select, rc); assert(3 == my_process_stmt_result(stmt_select)); - rc= mysql_execute(stmt_drop); + rc= mysql_stmt_execute(stmt_drop); check_execute(stmt_drop, rc); fprintf(stdout, "droped %i\n", i); } - + mysql_stmt_close(stmt_create); mysql_stmt_close(stmt_drop); mysql_stmt_close(stmt_select); @@ -8905,41 +8732,41 @@ static void test_rename() const char *query= "rename table t1 to t2, t3 to t4"; int rc; myheader("test_table_manipulation"); - - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1,t2,t3,t4"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1, t2, t3, t4"); myquery(rc); - - stmt= mysql_prepare(mysql, query, strlen(query)); + + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - rc= mysql_query(mysql,"create table t1 (a int)"); + rc= mysql_query(mysql, "create table t1 (a int)"); myquery(rc); - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute_r(stmt, rc); fprintf(stdout, "rename without t3\n"); - rc= mysql_query(mysql,"create table t3 (a int)"); + rc= mysql_query(mysql, "create table t3 (a int)"); myquery(rc); - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); fprintf(stdout, "rename with t3\n"); - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute_r(stmt, rc); fprintf(stdout, "rename renamed\n"); - rc= mysql_query(mysql,"rename table t2 to t1, t4 to t3"); + rc= mysql_query(mysql, "rename table t2 to t1, t4 to t3"); myquery(rc); - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); fprintf(stdout, "rename reverted\n"); mysql_stmt_close(stmt); - rc= mysql_query(mysql, "DROP TABLE t2,t4"); + rc= mysql_query(mysql, "DROP TABLE t2, t4"); myquery(rc); } @@ -8950,35 +8777,36 @@ static void test_do_set() char *query; int rc, i; myheader("test_do_set"); - - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); myquery(rc); - rc= mysql_query(mysql,"create table t1 (a int)"); + rc= mysql_query(mysql, "create table t1 (a int)"); myquery(rc); - + query= (char*)"do @var:=(1 in (select * from t1))"; - stmt_do= mysql_prepare(mysql, query, strlen(query)); + stmt_do= mysql_simple_prepare(mysql, query); check_stmt(stmt_do); query= (char*)"set @var=(1 in (select * from t1))"; - stmt_set= mysql_prepare(mysql, query, strlen(query)); + stmt_set= mysql_simple_prepare(mysql, query); check_stmt(stmt_set); for (i= 0; i < 3; i++) { - rc= mysql_execute(stmt_do); + rc= mysql_stmt_execute(stmt_do); check_execute(stmt_do, rc); fprintf(stdout, "do %i\n", i); - rc= mysql_execute(stmt_set); + rc= mysql_stmt_execute(stmt_set); check_execute(stmt_set, rc); - fprintf(stdout, "set %i\n", i); + fprintf(stdout, "set %i\n", i); } - + mysql_stmt_close(stmt_do); mysql_stmt_close(stmt_set); } + static void test_multi() { MYSQL_STMT *stmt_delete, *stmt_update, *stmt_select1, *stmt_select2; @@ -8989,61 +8817,65 @@ static void test_multi() ulong length= 1; myheader("test_multi"); + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); + bind[0].buffer_type= MYSQL_TYPE_LONG; bind[0].buffer= (char *)¶m; - bind[0].buffer_length= 0; - bind[0].is_null= 0; bind[0].length= &length; - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1, t2"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1, t2"); myquery(rc); - rc= mysql_query(mysql,"create table t1 (a int, b int)"); + rc= mysql_query(mysql, "create table t1 (a int, b int)"); myquery(rc); - rc= mysql_query(mysql,"create table t2 (a int, b int)"); + rc= mysql_query(mysql, "create table t2 (a int, b int)"); myquery(rc); - rc= mysql_query(mysql,"insert into t1 values (3,3), (2,2), (1,1)"); + rc= mysql_query(mysql, "insert into t1 values (3, 3), (2, 2), (1, 1)"); myquery(rc); - rc= mysql_query(mysql,"insert into t2 values (3,3), (2,2), (1,1)"); + rc= mysql_query(mysql, "insert into t2 values (3, 3), (2, 2), (1, 1)"); myquery(rc); - - query= (char*)"delete t1,t2 from t1,t2 where t1.a=t2.a and t1.b=10"; - stmt_delete= mysql_prepare(mysql, query, strlen(query)); + + query= (char*)"delete t1, t2 from t1, t2 where t1.a=t2.a and t1.b=10"; + stmt_delete= mysql_simple_prepare(mysql, query); check_stmt(stmt_delete); - query= (char*)"update t1,t2 set t1.b=10,t2.b=10 where t1.a=t2.a and t1.b=?"; - stmt_update= mysql_prepare(mysql, query, strlen(query)); + query= (char*)"update t1, t2 set t1.b=10, t2.b=10 where t1.a=t2.a and t1.b=?"; + stmt_update= mysql_simple_prepare(mysql, query); check_stmt(stmt_update); query= (char*)"select * from t1"; - stmt_select1= mysql_prepare(mysql, query, strlen(query)); + stmt_select1= mysql_simple_prepare(mysql, query); check_stmt(stmt_select1); query= (char*)"select * from t2"; - stmt_select2= mysql_prepare(mysql, query, strlen(query)); + stmt_select2= mysql_simple_prepare(mysql, query); check_stmt(stmt_select2); for(i= 0; i < 3; i++) { - rc= mysql_bind_param(stmt_update, bind); - check_execute(stmt_update,rc); + rc= mysql_stmt_bind_param(stmt_update, bind); + check_execute(stmt_update, rc); - rc= mysql_execute(stmt_update); + rc= mysql_stmt_execute(stmt_update); check_execute(stmt_update, rc); fprintf(stdout, "update %ld\n", param); - - rc= mysql_execute(stmt_delete); + + rc= mysql_stmt_execute(stmt_delete); check_execute(stmt_delete, rc); fprintf(stdout, "delete %ld\n", param); - rc= mysql_execute(stmt_select1); + rc= mysql_stmt_execute(stmt_select1); check_execute(stmt_select1, rc); assert((uint)(3-param) == my_process_stmt_result(stmt_select1)); - rc= mysql_execute(stmt_select2); + rc= mysql_stmt_execute(stmt_select2); check_execute(stmt_select2, rc); assert((uint)(3-param) == my_process_stmt_result(stmt_select2)); @@ -9054,7 +8886,7 @@ static void test_multi() mysql_stmt_close(stmt_update); mysql_stmt_close(stmt_select1); mysql_stmt_close(stmt_select2); - rc= mysql_query(mysql,"drop table t1,t2"); + rc= mysql_query(mysql, "drop table t1, t2"); myquery(rc); } @@ -9067,40 +8899,40 @@ static void test_insert_select() uint i; myheader("test_insert_select"); - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1, t2"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1, t2"); myquery(rc); - rc= mysql_query(mysql,"create table t1 (a int)"); + rc= mysql_query(mysql, "create table t1 (a int)"); myquery(rc); - rc= mysql_query(mysql,"create table t2 (a int)"); + rc= mysql_query(mysql, "create table t2 (a int)"); myquery(rc); - rc= mysql_query(mysql,"insert into t2 values (1)"); + rc= mysql_query(mysql, "insert into t2 values (1)"); myquery(rc); - + query= (char*)"insert into t1 select a from t2"; - stmt_insert= mysql_prepare(mysql, query, strlen(query)); + stmt_insert= mysql_simple_prepare(mysql, query); check_stmt(stmt_insert); query= (char*)"select * from t1"; - stmt_select= mysql_prepare(mysql, query, strlen(query)); + stmt_select= mysql_simple_prepare(mysql, query); check_stmt(stmt_select); for(i= 0; i < 3; i++) { - rc= mysql_execute(stmt_insert); + rc= mysql_stmt_execute(stmt_insert); check_execute(stmt_insert, rc); fprintf(stdout, "insert %u\n", i); - - rc= mysql_execute(stmt_select); + + rc= mysql_stmt_execute(stmt_select); check_execute(stmt_select, rc); assert((i+1) == my_process_stmt_result(stmt_select)); } mysql_stmt_close(stmt_insert); mysql_stmt_close(stmt_select); - rc= mysql_query(mysql,"drop table t1,t2"); + rc= mysql_query(mysql, "drop table t1, t2"); myquery(rc); } @@ -9111,79 +8943,87 @@ static void test_bind_nagative() char *query; int rc; MYSQL_BIND bind[1]; - long my_val = 0L; - ulong my_length = 0L; - long my_null = 0L; + long my_val= 0L; + ulong my_length= 0L; + long my_null= 0L; myheader("test_insert_select"); - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); myquery(rc); - rc= mysql_query(mysql,"create temporary table t1 (c1 int unsigned)"); + rc= mysql_query(mysql, "create temporary table t1 (c1 int unsigned)"); myquery(rc); - rc= mysql_query(mysql,"INSERT INTO t1 VALUES (1),(-1)"); + rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1), (-1)"); myquery(rc); query= (char*)"INSERT INTO t1 VALUES (?)"; - stmt_insert= mysql_prepare(mysql, query, strlen(query)); + stmt_insert= mysql_simple_prepare(mysql, query); check_stmt(stmt_insert); /* bind parameters */ - bind[0].buffer_type = FIELD_TYPE_LONG; - bind[0].buffer = (char *)&my_val; - bind[0].length = &my_length; - bind[0].is_null = (char*)&my_null; + bzero((char*) bind, sizeof(bind)); - rc= mysql_bind_param(stmt_insert, bind); - check_execute(stmt_insert,rc); + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (char *)&my_val; + bind[0].length= &my_length; + bind[0].is_null= (char*)&my_null; - my_val = -1; - rc= mysql_execute(stmt_insert); + rc= mysql_stmt_bind_param(stmt_insert, bind); + check_execute(stmt_insert, rc); + + my_val= -1; + rc= mysql_stmt_execute(stmt_insert); check_execute(stmt_insert, rc); mysql_stmt_close(stmt_insert); - rc= mysql_query(mysql,"drop table t1"); + rc= mysql_query(mysql, "drop table t1"); myquery(rc); } + static void test_derived() { MYSQL_STMT *stmt; int rc, i; MYSQL_BIND bind[1]; - long my_val = 0L; - ulong my_length = 0L; - long my_null = 0L; + long my_val= 0L; + ulong my_length= 0L; + long my_null= 0L; const char *query= "select count(1) from (select f.id from t1 f where f.id=?) as x"; myheader("test_derived"); - - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); myquery(rc); - - rc= mysql_query(mysql,"create table t1 (id int(8), primary key (id)) \ + + rc= mysql_query(mysql, "create table t1 (id int(8), primary key (id)) \ TYPE=InnoDB DEFAULT CHARSET=utf8"); myquery(rc); rc= mysql_query(mysql, "insert into t1 values (1)"); myquery(rc); - stmt= mysql_prepare(mysql, query, strlen(query)); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); - bind[0].buffer_type = FIELD_TYPE_LONG; - bind[0].buffer = (char *)&my_val; - bind[0].length = &my_length; - bind[0].is_null = (char*)&my_null; + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (char *)&my_val; + bind[0].length= &my_length; + bind[0].is_null= (char*)&my_null; my_val= 1; - rc= mysql_bind_param(stmt, bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); for (i= 0; i < 3; i++) { - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(1 == my_process_stmt_result(stmt)); } @@ -9199,52 +9039,53 @@ static void test_xjoin() MYSQL_STMT *stmt; int rc, i; const char *query= - "select t.id,p1.value, n1.value, p2.value, n2.value from t3 t LEFT JOIN t1 p1 ON (p1.id=t.param1_id) LEFT JOIN t2 p2 ON (p2.id=t.param2_id) LEFT JOIN t4 n1 ON (n1.id=p1.name_id) LEFT JOIN t4 n2 ON (n2.id=p2.name_id) where t.id=1"; + "select t.id, p1.value, n1.value, p2.value, n2.value from t3 t LEFT JOIN t1 p1 ON (p1.id=t.param1_id) LEFT JOIN t2 p2 ON (p2.id=t.param2_id) LEFT JOIN t4 n1 ON (n1.id=p1.name_id) LEFT JOIN t4 n2 ON (n2.id=p2.name_id) where t.id=1"; myheader("test_xjoin"); - - rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1,t2,t3,t4"); - myquery(rc); - - rc= mysql_query(mysql,"create table t3 (id int(8), param1_id int(8), param2_id int(8)) TYPE=InnoDB DEFAULT CHARSET=utf8"); - myquery(rc); - - rc= mysql_query(mysql,"create table t1 ( id int(8), name_id int(8), value varchar(10)) TYPE=InnoDB DEFAULT CHARSET=utf8"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1, t2, t3, t4"); myquery(rc); - rc= mysql_query(mysql,"create table t2 (id int(8), name_id int(8), value varchar(10)) TYPE=InnoDB DEFAULT CHARSET=utf8;"); + rc= mysql_query(mysql, "create table t3 (id int(8), param1_id int(8), param2_id int(8)) TYPE=InnoDB DEFAULT CHARSET=utf8"); myquery(rc); - rc= mysql_query(mysql,"create table t4(id int(8), value varchar(10)) TYPE=InnoDB DEFAULT CHARSET=utf8"); + rc= mysql_query(mysql, "create table t1 ( id int(8), name_id int(8), value varchar(10)) TYPE=InnoDB DEFAULT CHARSET=utf8"); myquery(rc); - rc= mysql_query(mysql, "insert into t3 values (1,1,1),(2,2,null)"); - myquery(rc); - - rc= mysql_query(mysql, "insert into t1 values (1,1,'aaa'),(2,null,'bbb')"); + rc= mysql_query(mysql, "create table t2 (id int(8), name_id int(8), value varchar(10)) TYPE=InnoDB DEFAULT CHARSET=utf8;"); myquery(rc); - rc= mysql_query(mysql,"insert into t2 values (1,2,'ccc')"); + rc= mysql_query(mysql, "create table t4(id int(8), value varchar(10)) TYPE=InnoDB DEFAULT CHARSET=utf8"); myquery(rc); - rc= mysql_query(mysql, "insert into t4 values (1,'Name1'),(2,null)"); + rc= mysql_query(mysql, "insert into t3 values (1, 1, 1), (2, 2, null)"); myquery(rc); - stmt= mysql_prepare(mysql, query, strlen(query)); + rc= mysql_query(mysql, "insert into t1 values (1, 1, 'aaa'), (2, null, 'bbb')"); + myquery(rc); + + rc= mysql_query(mysql, "insert into t2 values (1, 2, 'ccc')"); + myquery(rc); + + rc= mysql_query(mysql, "insert into t4 values (1, 'Name1'), (2, null)"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); for (i= 0; i < 3; i++) { - rc= mysql_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); assert(1 == my_process_stmt_result(stmt)); } mysql_stmt_close(stmt); - rc= mysql_query(mysql, "DROP TABLE t1,t2,t3,t4"); + rc= mysql_query(mysql, "DROP TABLE t1, t2, t3, t4"); myquery(rc); } + static void test_bug3035() { MYSQL_STMT *stmt; @@ -9259,14 +9100,14 @@ static void test_bug3035() longlong int64_val; ulonglong uint64_val; double double_val, udouble_val; - char longlong_as_string[22],ulonglong_as_string[22]; + char longlong_as_string[22], ulonglong_as_string[22]; /* mins and maxes */ const int8 int8_min= -128; const int8 int8_max= 127; const uint8 uint8_min= 0; const uint8 uint8_max= 255; - + const int16 int16_min= -32768; const int16 int16_max= 32767; const uint16 uint16_min= 0; @@ -9283,11 +9124,11 @@ static void test_bug3035() const ulonglong uint64_min= 0U; const ulonglong uint64_max= ULL(18446744073709551615); - + const char *stmt_text; - + myheader("test_bug3035"); - + stmt_text= "DROP TABLE IF EXISTS t1"; rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); myquery(rc); @@ -9311,7 +9152,7 @@ static void test_bug3035() bind_array[2].buffer_type= MYSQL_TYPE_SHORT; bind_array[2].buffer= (char*) &int16_val; - + bind_array[3].buffer_type= MYSQL_TYPE_SHORT; bind_array[3].buffer= (char*) &uint16_val; bind_array[3].is_unsigned= 1; @@ -9325,7 +9166,7 @@ static void test_bug3035() bind_array[6].buffer_type= MYSQL_TYPE_LONGLONG; bind_array[6].buffer= (char*) &int64_val; - + bind_array[7].buffer_type= MYSQL_TYPE_LONGLONG; bind_array[7].buffer= (char*) &uint64_val; bind_array[7].is_unsigned= 1; @@ -9351,7 +9192,7 @@ static void test_bug3035() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - + int8_val= int8_max; uint8_val= uint8_max; int16_val= int16_max; @@ -9365,7 +9206,7 @@ static void test_bug3035() check_execute(stmt, rc); stmt_text= "SELECT i8, ui8, i16, ui16, i32, ui32, i64, ui64, ui64, " - "cast(ui64 as signed),ui64, cast(ui64 as signed)" + "cast(ui64 as signed), ui64, cast(ui64 as signed)" "FROM t1 ORDER BY id ASC"; rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); @@ -9387,7 +9228,7 @@ static void test_bug3035() bind_array[11].buffer_type= MYSQL_TYPE_STRING; bind_array[11].buffer= (char*) &longlong_as_string; bind_array[11].buffer_length= sizeof(longlong_as_string); - + mysql_stmt_bind_result(stmt, bind_array); rc= mysql_stmt_fetch(stmt); @@ -9408,7 +9249,7 @@ static void test_bug3035() rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); - + assert(int8_val == int8_max); assert(uint8_val == uint8_max); assert(int16_val == int16_max); @@ -9423,7 +9264,7 @@ static void test_bug3035() assert(!strcmp(ulonglong_as_string, "18446744073709551615")); rc= mysql_stmt_fetch(stmt); - assert(rc == MYSQL_NO_DATA); + assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); @@ -9431,31 +9272,32 @@ static void test_bug3035() mysql_real_query(mysql, stmt_text, strlen(stmt_text)); } + static void test_union2() { MYSQL_STMT *stmt; int rc, i; myheader("test_union2"); - + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); myquery(rc); - rc= mysql_query(mysql,"CREATE TABLE t1(col1 INT,\ - col2 VARCHAR(40), \ - col3 SMALLINT,\ + rc= mysql_query(mysql, "CREATE TABLE t1(col1 INT, \ + col2 VARCHAR(40), \ + col3 SMALLINT, \ col4 TIMESTAMP)"); myquery(rc); stmt= mysql_simple_prepare(mysql, - "select col1 FROM t1 where col1=1 union distinct \ -select col1 FROM t1 where col1=2"); + "select col1 FROM t1 where col1=1 union distinct " + "select col1 FROM t1 where col1=2"); check_stmt(stmt); for (i= 0; i < 3; i++) { rc= mysql_stmt_execute(stmt); - check_execute(stmt,rc); + check_execute(stmt, rc); assert(0 == my_process_stmt_result(stmt)); } @@ -9467,7 +9309,7 @@ select col1 FROM t1 where col1=2"); /* - This tests for various mysql_send_long_data bugs described in #1664 + This tests for various mysql_stmt_send_long_data bugs described in #1664 */ static void test_bug1664() @@ -9477,54 +9319,54 @@ static void test_bug1664() const char *data; const char *str_data= "Simple string"; MYSQL_BIND bind[2]; - const char *query= "INSERT INTO test_long_data(col2, col1) VALUES(?,?)"; - + const char *query= "INSERT INTO test_long_data(col2, col1) VALUES(?, ?)"; + myheader("test_bug1664"); - - rc= mysql_query(mysql,"DROP TABLE IF EXISTS test_long_data"); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_long_data"); myquery(rc); - - rc= mysql_query(mysql,"CREATE TABLE test_long_data(col1 int, col2 long varchar)"); + + rc= mysql_query(mysql, "CREATE TABLE test_long_data(col1 int, col2 long varchar)"); myquery(rc); - + stmt= mysql_stmt_init(mysql); check_stmt(stmt); rc= mysql_stmt_prepare(stmt, query, strlen(query)); check_execute(stmt, rc); - + verify_param_count(stmt, 2); - + bzero(&bind, sizeof(bind)); - - bind[0].buffer_type= FIELD_TYPE_STRING; + + bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].buffer= (char *)str_data; bind[0].buffer_length= strlen(str_data); bind[1].buffer= (char *)&int_data; - bind[1].buffer_type= FIELD_TYPE_LONG; - - rc= mysql_stmt_bind_param(stmt,bind); + bind[1].buffer_type= MYSQL_TYPE_LONG; + + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - + int_data= 1; - /* - Let us supply empty long_data. This should work and should + /* + Let us supply empty long_data. This should work and should not break following execution. */ data= ""; - rc= mysql_stmt_send_long_data(stmt,0,data,strlen(data)); - check_execute(stmt,rc); + rc= mysql_stmt_send_long_data(stmt, 0, data, strlen(data)); + check_execute(stmt, rc); rc= mysql_stmt_execute(stmt); - check_execute(stmt,rc); - - verify_col_data("test_long_data","col1","1"); - verify_col_data("test_long_data","col2",""); + check_execute(stmt, rc); - rc= mysql_query(mysql,"DELETE FROM test_long_data"); + verify_col_data("test_long_data", "col1", "1"); + verify_col_data("test_long_data", "col2", ""); + + rc= mysql_query(mysql, "DELETE FROM test_long_data"); myquery(rc); - + /* This should pass OK */ data= (char *)"Data"; rc= mysql_stmt_send_long_data(stmt, 0, data, strlen(data)); @@ -9532,7 +9374,7 @@ static void test_bug1664() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - + verify_col_data("test_long_data", "col1", "1"); verify_col_data("test_long_data", "col2", "Data"); @@ -9542,51 +9384,51 @@ static void test_bug1664() /* Now we are changing int parameter and don't do anything - with first parameter. Second mysql_execute() should run + with first parameter. Second mysql_stmt_execute() should run OK treating this first parameter as string parameter. */ - + int_data= 2; /* execute */ - rc = mysql_stmt_execute(stmt); + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - + verify_col_data("test_long_data", "col1", "2"); verify_col_data("test_long_data", "col2", str_data); /* clean up */ rc= mysql_query(mysql, "DELETE FROM test_long_data"); myquery(rc); - + /* - Now we are sending other long data. It should not be + Now we are sending other long data. It should not be concatened to previous. */ data= (char *)"SomeOtherData"; rc= mysql_stmt_send_long_data(stmt, 0, data, strlen(data)); check_execute(stmt, rc); - + rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); verify_col_data("test_long_data", "col1", "2"); verify_col_data("test_long_data", "col2", "SomeOtherData"); - + mysql_stmt_close(stmt); /* clean up */ rc= mysql_query(mysql, "DELETE FROM test_long_data"); myquery(rc); - + /* Now let us test how mysql_stmt_reset works. */ stmt= mysql_stmt_init(mysql); check_stmt(stmt); rc= mysql_stmt_prepare(stmt, query, strlen(query)); check_execute(stmt, rc); - rc= mysql_bind_param(stmt, bind); + rc= mysql_stmt_bind_param(stmt, bind); check_execute(stmt, rc); - + data= (char *)"SomeData"; rc= mysql_stmt_send_long_data(stmt, 0, data, strlen(data)); check_execute(stmt, rc); @@ -9596,12 +9438,12 @@ static void test_bug1664() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - + verify_col_data("test_long_data", "col1", "2"); verify_col_data("test_long_data", "col2", str_data); mysql_stmt_close(stmt); - + /* Final clean up */ rc= mysql_query(mysql, "DROP TABLE test_long_data"); myquery(rc); @@ -9614,35 +9456,31 @@ static void test_order_param() int rc; myheader("test_order_param"); - + rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); myquery(rc); - rc= mysql_query(mysql,"CREATE TABLE t1(a INT, b char(10))"); + rc= mysql_query(mysql, "CREATE TABLE t1(a INT, b char(10))"); myquery(rc); stmt= mysql_simple_prepare(mysql, - "select sum(a) + 200, 1 from t1 \ -union distinct \ -select sum(a) + 200, 1 from t1 \ -group by b "); - check_stmt(stmt); - mysql_stmt_close(stmt); - - stmt= mysql_simple_prepare(mysql, - "select sum(a) + 200, ? from t1 \ -group by b \ -union distinct \ -select sum(a) + 200, 1 from t1 \ -group by b "); + "select sum(a) + 200, 1 from t1 " + " union distinct " + "select sum(a) + 200, 1 from t1 group by b "); check_stmt(stmt); mysql_stmt_close(stmt); stmt= mysql_simple_prepare(mysql, - "select sum(a) + 200, ? from t1 \ -union distinct \ -select sum(a) + 200, 1 from t1 \ -group by b "); + "select sum(a) + 200, ? from t1 group by b " + " union distinct " + "select sum(a) + 200, 1 from t1 group by b "); + check_stmt(stmt); + mysql_stmt_close(stmt); + + stmt= mysql_simple_prepare(mysql, + "select sum(a) + 200, ? from t1 " + " union distinct " + "select sum(a) + 200, 1 from t1 group by b "); check_stmt(stmt); mysql_stmt_close(stmt); @@ -9658,35 +9496,41 @@ static void test_union_param() int rc, i; MYSQL_BIND bind[2]; char my_val[4]; - ulong my_length = 3L; - long my_null = 0L; + ulong my_length= 3L; + long my_null= 0L; myheader("test_union_param"); strcpy(my_val, "abc"); - + query= (char*)"select ? as my_col union distinct select ?"; - stmt= mysql_prepare(mysql, query, strlen(query)); + stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); + /* + We need to bzero bind structure because mysql_stmt_bind_param checks all + its members. + */ + bzero((char*) bind, sizeof(bind)); + /* bind parameters */ - bind[0].buffer_type= FIELD_TYPE_STRING; + bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].buffer= (char*) &my_val; bind[0].buffer_length= 4; bind[0].length= &my_length; bind[0].is_null= (char*)&my_null; - bind[1].buffer_type= FIELD_TYPE_STRING; + bind[1].buffer_type= MYSQL_TYPE_STRING; bind[1].buffer= (char*) &my_val; bind[1].buffer_length= 4; bind[1].length= &my_length; bind[1].is_null= (char*)&my_null; - rc= mysql_bind_param(stmt, bind); - check_execute(stmt,rc); + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); for (i= 0; i < 3; i++) { rc= mysql_stmt_execute(stmt); - check_execute(stmt,rc); + check_execute(stmt, rc); assert(1 == my_process_stmt_result(stmt)); } @@ -9716,31 +9560,31 @@ static void test_ps_i18n() /* Create table with binary columns, set session character set to cp1251, client character set to koi8, and make sure that there is conversion - on insert and no conversion on select + on insert and no conversion on select */ stmt_text= "CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255))"; rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); myquery(rc); - + stmt_text= "SET CHARACTER_SET_CLIENT=koi8r, " "CHARACTER_SET_CONNECTION=cp1251, " "CHARACTER_SET_RESULTS=koi8r"; - + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); myquery(rc); - + bzero(bind_array, sizeof(bind_array)); bind_array[0].buffer_type= MYSQL_TYPE_STRING; bind_array[0].buffer= (char*) koi8; bind_array[0].buffer_length= strlen(koi8); - + bind_array[1].buffer_type= MYSQL_TYPE_STRING; bind_array[1].buffer= (char*) koi8; bind_array[1].buffer_length= strlen(koi8); - + stmt= mysql_stmt_init(mysql); check_stmt(stmt); @@ -9784,7 +9628,7 @@ static void test_ps_i18n() assert(!memcmp(buf2, cp1251, buf1_len)); rc= mysql_stmt_fetch(stmt); - assert(rc == MYSQL_NO_DATA); + assert(rc == MYSQL_NO_DATA); stmt_text= "DROP TABLE IF EXISTS t1"; rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); @@ -9796,23 +9640,23 @@ static void test_ps_i18n() binary data. Binary data must not be converted on insert, and both columns must be converted to client character set on select. */ - + stmt_text= "CREATE TABLE t1 (c1 VARCHAR(255) CHARACTER SET cp1251, " "c2 VARCHAR(255) CHARACTER SET cp1251)"; rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); myquery(rc); - + stmt_text= "INSERT INTO t1 (c1, c2) VALUES (?, ?)"; rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); check_execute(stmt, rc); - + /* this data must be converted */ bind_array[0].buffer_type= MYSQL_TYPE_STRING; bind_array[0].buffer= (char*) koi8; bind_array[0].buffer_length= strlen(koi8); - + bind_array[1].buffer_type= MYSQL_TYPE_STRING; bind_array[1].buffer= (char*) koi8; bind_array[1].buffer_length= strlen(koi8); @@ -9823,16 +9667,16 @@ static void test_ps_i18n() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - + /* this data must not be converted */ bind_array[0].buffer_type= MYSQL_TYPE_BLOB; bind_array[0].buffer= (char*) cp1251; bind_array[0].buffer_length= strlen(cp1251); - + bind_array[1].buffer_type= MYSQL_TYPE_BLOB; bind_array[1].buffer= (char*) cp1251; bind_array[1].buffer_length= strlen(cp1251); - + mysql_stmt_bind_param(stmt, bind_array); mysql_stmt_send_long_data(stmt, 0, cp1251, strlen(cp1251)); @@ -9841,7 +9685,7 @@ static void test_ps_i18n() check_execute(stmt, rc); /* Fetch data and verify that rows are in koi8 */ - + stmt_text= "SELECT c1, c2 FROM t1"; /* c1 and c2 are binary so no conversion will be done on select */ @@ -9868,7 +9712,7 @@ static void test_ps_i18n() assert(!memcmp(buf1, koi8, buf1_len)); assert(!memcmp(buf2, koi8, buf1_len)); } - assert(rc == MYSQL_NO_DATA); + assert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); stmt_text= "DROP TABLE t1"; @@ -9891,7 +9735,7 @@ static void test_bug3796() ulong out_length; const char *stmt_text; int rc; - + myheader("test_bug3796"); /* Create and fill test table */ @@ -9902,25 +9746,25 @@ static void test_bug3796() stmt_text= "CREATE TABLE t1 (a INT, b VARCHAR(30))"; rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); myquery(rc); - - stmt_text= "INSERT INTO t1 VALUES(1,'ONE'), (2,'TWO')"; + + stmt_text= "INSERT INTO t1 VALUES(1, 'ONE'), (2, 'TWO')"; rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); myquery(rc); /* Create statement handle and prepare it with select */ - stmt = mysql_stmt_init(mysql); + stmt= mysql_stmt_init(mysql); stmt_text= "SELECT concat(?, b) FROM t1"; rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); check_execute(stmt, rc); - + /* Bind input buffers */ bzero(bind, sizeof(bind)); bind[0].buffer_type= MYSQL_TYPE_STRING; bind[0].buffer= (char*) concat_arg0; bind[0].buffer_length= strlen(concat_arg0); - + mysql_stmt_bind_param(stmt, bind); /* Execute the select statement */ @@ -9947,7 +9791,7 @@ static void test_bug3796() assert(strlen(canonical_buff) == out_length && strncmp(out_buff, canonical_buff, out_length) == 0); printf("Concat result: '%s'\n", out_buff); - + rc= mysql_stmt_fetch(stmt); assert(rc == MYSQL_NO_DATA); @@ -9958,6 +9802,73 @@ static void test_bug3796() myquery(rc); } + +static void test_bug4026() +{ + MYSQL_STMT *stmt; + MYSQL_BIND bind[2]; + MYSQL_TIME time_in, time_out; + MYSQL_TIME datetime_in, datetime_out; + const char *stmt_text; + int rc; + + myheader("test_bug4026"); + + /* Check that microseconds are inserted and selected successfully */ + + /* Create a statement handle and prepare it with select */ + stmt= mysql_stmt_init(mysql); + stmt_text= "SELECT ?, ?"; + + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + check_execute(stmt, rc); + + /* Bind input buffers */ + bzero(bind, sizeof(bind)); + bzero(&time_in, sizeof(time_in)); + bzero(&time_out, sizeof(time_out)); + bzero(&datetime_in, sizeof(datetime_in)); + bzero(&datetime_out, sizeof(datetime_out)); + + bind[0].buffer_type= MYSQL_TYPE_TIME; + bind[0].buffer= (char*) &time_in; + bind[1].buffer_type= MYSQL_TYPE_DATETIME; + bind[1].buffer= (char*) &datetime_in; + + time_in.hour= 23; + time_in.minute= 59; + time_in.second= 59; + time_in.second_part= 123456; + + datetime_in= time_in; + datetime_in.year= 2003; + datetime_in.month= 12; + datetime_in.day= 31; + + mysql_stmt_bind_param(stmt, bind); + + /* Execute the select statement */ + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + bind[0].buffer= (char*) &time_out; + bind[1].buffer= (char*) &datetime_out; + + mysql_stmt_bind_result(stmt, bind); + + rc= mysql_stmt_fetch(stmt); + assert(rc == 0); + printf("%d:%d:%d.%lu\n", time_out.hour, time_out.minute, time_out.second, + time_out.second_part); + printf("%d-%d-%d %d:%d:%d.%lu\n", datetime_out.year, datetime_out.month, + datetime_out.day, datetime_out.hour, + datetime_out.minute, datetime_out.second, + datetime_out.second_part); + assert(memcmp(&time_in, &time_out, sizeof(time_in)) == 0); + assert(memcmp(&datetime_in, &datetime_out, sizeof(datetime_in)) == 0); + mysql_stmt_close(stmt); +} + /* Read and parse arguments and MySQL options from my.cnf */ @@ -9994,7 +9905,7 @@ static struct my_option client_test_long_options[] = static void client_test_print_version(void) { fprintf(stdout, "%s Distrib %s, for %s (%s)\n\n", - my_progname,MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); + my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); } @@ -10002,18 +9913,18 @@ static void usage(void) { /* * show the usage string when the user asks for this - */ - putc('\n',stdout); + */ + putc('\n', stdout); puts("***********************************************************************\n"); puts(" Test for client-server protocol 4.1"); puts(" By Monty & Venu \n"); - puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); + puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software, "); puts("and you are welcome to modify and redistribute it under the GPL license\n"); puts(" Copyright (C) 1995-2003 MySQL AB "); puts("-----------------------------------------------------------------------\n"); client_test_print_version(); - fprintf(stdout,"Usage: %s [OPTIONS]\n\n", my_progname); - + fprintf(stdout, "Usage: %s [OPTIONS]\n\n", my_progname); + my_print_help(client_test_long_options); print_defaults("my", client_test_load_default_groups); my_print_variables(client_test_long_options); @@ -10023,7 +9934,7 @@ static void usage(void) static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), - char *argument) + char *argument) { switch (optid) { case '#': @@ -10035,7 +9946,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *start=argument; my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); opt_password= my_strdup(argument, MYF(MY_FAE)); - while (*argument) *argument++= 'x'; /* Destroy argument */ + while (*argument) *argument++= 'x'; /* Destroy argument */ if (*start) start[1]=0; } @@ -10043,7 +9954,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), tty_password= 1; break; case '?': - case 'I': /* Info */ + case 'I': /* Info */ usage(); exit(0); break; @@ -10055,12 +9966,12 @@ static void get_options(int argc, char **argv) { int ho_error; - if ((ho_error= handle_options(&argc, &argv, client_test_long_options, + if ((ho_error= handle_options(&argc, &argv, client_test_long_options, get_one_option))) exit(ho_error); if (tty_password) - opt_password=get_tty_password(NullS); + opt_password= get_tty_password(NullS); return; } @@ -10070,49 +9981,51 @@ static void get_options(int argc, char **argv) static void print_test_output() { - fprintf(stdout,"\n\n"); - fprintf(stdout,"All '%d' tests were successful (in '%d' iterations)", + fprintf(stdout, "\n\n"); + fprintf(stdout, "All '%d' tests were successful (in '%d' iterations)", test_count-1, opt_count); - fprintf(stdout,"\n Total execution time: %g SECS", total_time); + fprintf(stdout, "\n Total execution time: %g SECS", total_time); if (opt_count > 1) - fprintf(stdout," (Avg: %g SECS)", total_time/opt_count); - - fprintf(stdout,"\n\n!!! SUCCESS !!!\n"); + fprintf(stdout, " (Avg: %g SECS)", total_time/opt_count); + + fprintf(stdout, "\n\n!!! SUCCESS !!!\n"); } -/******************************************************** -* main routine * -*********************************************************/ + +/*************************************************************************** + main routine +***************************************************************************/ + int main(int argc, char **argv) -{ +{ DEBUGGER_OFF; MY_INIT(argv[0]); - load_defaults("my",client_test_load_default_groups,&argc,&argv); + load_defaults("my", client_test_load_default_groups, &argc, &argv); defaults_argv= argv; - get_options(argc,argv); - + get_options(argc, argv); + client_connect(); /* connect to server */ - + total_time= 0; - for (iter_count=1; iter_count <= opt_count; iter_count++) + for (iter_count= 1; iter_count <= opt_count; iter_count++) { /* Start of tests */ test_count= 1; - + start_time= time((time_t *)0); client_query(); /* simple client query test */ #if NOT_YET_WORKING /* Used for internal new development debugging */ - test_drop_temp(); /* to test DROP TEMPORARY TABLE Access checks */ + test_drop_temp(); /* Test DROP TEMPORARY TABLE Access checks */ #endif - test_fetch_seek(); /* to test stmt seek() functions */ + test_fetch_seek(); /* Test stmt seek() functions */ test_fetch_nobuffs(); /* to fecth without prior bound buffers */ test_open_direct(); /* direct execution in the middle of open stmts */ test_fetch_null(); /* to fetch null data */ test_ps_null_param(); /* Fetch value of null parameter */ - test_fetch_date(); /* to fetch date,time and timestamp */ + test_fetch_date(); /* to fetch date, time and timestamp */ test_fetch_str(); /* to fetch string to all types */ test_fetch_long(); /* to fetch long to all types */ test_fetch_short(); /* to fetch short to all types */ @@ -10129,12 +10042,12 @@ int main(int argc, char **argv) test_ps_conj_select(); /* prepare select with "where a=? or b=?" */ test_select_show_table();/* simple show prepare */ #if NOT_USED - /* - Enable this tests from 4.1.1 when mysql_param_result() is - supported + /* + Enable this tests from 4.1.1 when mysql_param_result() is + supported */ test_select_meta(); /* select param meta information */ - test_update_meta(); /* update param meta information */ + test_update_meta(); /* update param meta information */ test_insert_meta(); /* insert param meta information */ #endif test_func_fields(); /* test for new 4.1 MYSQL_FIELD members */ @@ -10143,21 +10056,21 @@ int main(int argc, char **argv) test_set_variable(); /* prepare with set variables */ test_select_show(); /* prepare - show test */ test_prepare_noparam(); /* prepare without parameters */ - test_bind_result(); /* result bind test */ - test_prepare_simple(); /* simple prepare */ + test_bind_result(); /* result bind test */ + test_prepare_simple(); /* simple prepare */ test_prepare(); /* prepare test */ test_null(); /* test null data handling */ test_debug_example(); /* some debugging case */ test_update(); /* prepare-update test */ test_simple_update(); /* simple prepare with update */ test_simple_delete(); /* prepare with delete */ - test_double_compare(); /* float comparision */ + test_double_compare(); /* float comparision */ client_store_result(); /* usage of mysql_store_result() */ - client_use_result(); /* usage of mysql_use_result() */ + client_use_result(); /* usage of mysql_use_result() */ test_tran_bdb(); /* transaction test on BDB table type */ - test_tran_innodb(); /* transaction test on InnoDB table type */ + test_tran_innodb(); /* transaction test on InnoDB table type */ test_prepare_ext(); /* test prepare with all types - conversion -- TODO */ + conversion -- TODO */ test_prepare_syntax(); /* syntax check for prepares */ test_field_names(); /* test for field names */ test_field_flags(); /* test to help .NET provider team */ @@ -10171,7 +10084,7 @@ int main(int argc, char **argv) test_prepare_field_result(); /* prepare meta info */ test_multi_stmt(); /* multi stmt test */ test_multi_statements();/* test multi statement execution */ - test_prepare_multi_statements(); /* check that multi statements are + test_prepare_multi_statements(); /* check that multi statements are disabled in PS */ test_store_result(); /* test the store_result */ test_store_result1(); /* test store result without buffers */ @@ -10189,72 +10102,77 @@ int main(int argc, char **argv) test_ushort_bug(); /* test a simple conv bug from php */ test_sshort_bug(); /* test a simple conv bug from php */ test_stiny_bug(); /* test a simple conv bug from php */ - test_field_misc(); /* check the field info for misc case, bug: #74 */ + test_field_misc(); /* check the field info for misc case, bug: #74 */ test_set_option(); /* test the SET OPTION feature, bug #85 */ /*TODO HF: here should be NO_EMBEDDED_ACCESS_CHECKS*/ #ifndef EMBEDDED_LIBRARY - test_prepare_grant(); /* to test the GRANT command, bug #89 */ + test_prepare_grant(); /* Test the GRANT command, bug #89 */ #endif test_frm_bug(); /* test the crash when .frm is invalid, bug #93 */ test_explain_bug(); /* test for the EXPLAIN, bug #115 */ test_decimal_bug(); /* test for the decimal bug */ test_nstmts(); /* test n statements */ - test_logs(); ; /* to test logs */ - test_cuted_rows(); /* to test for WARNINGS from cuted rows */ - test_fetch_offset(); /* to test mysql_fetch_column with offset */ - test_fetch_column(); /* to test mysql_fetch_column */ + test_logs(); ; /* Test logs */ + test_cuted_rows(); /* Test for WARNINGS from cuted rows */ + test_fetch_offset(); /* Test mysql_stmt_fetch_column with offset */ + test_fetch_column(); /* Test mysql_stmt_fetch_column */ test_mem_overun(); /* test DBD ovverun bug */ test_list_fields(); /* test COM_LIST_FIELDS for DEFAULT */ test_free_result(); /* test mysql_stmt_free_result() */ - test_free_store_result(); /* test to make sure stmt results are cleared + test_free_store_result(); /* test to make sure stmt results are cleared during stmt_free_result() */ test_sqlmode(); /* test for SQL_MODE */ test_ts(); /* test for timestamp BR#819 */ test_bug1115(); /* BUG#1115 */ test_bug1180(); /* BUG#1180 */ test_bug1500(); /* BUG#1500 */ - test_bug1644(); /* BUG#1644 */ - test_bug1946(); /* test that placeholders are allowed only in + test_bug1644(); /* BUG#1644 */ + test_bug1946(); /* test that placeholders are allowed only in prepared queries */ - test_bug2248(); /* BUG#2248 */ + test_bug2248(); /* BUG#2248 */ test_parse_error_and_bad_length(); /* test if bad length param in - mysql_prepare() triggers error */ + mysql_stmt_prepare() triggers error */ test_bug2247(); /* test that mysql_stmt_affected_rows() returns - number of rows affected by last prepared + number of rows affected by last prepared statement execution */ - test_subqueries(); /* repeatable subqueries */ + test_subqueries(); /* repeatable subqueries */ test_bad_union(); /* correct setup of UNION */ - test_distinct(); /* distinct aggregate functions */ + test_distinct(); /* distinct aggregate functions */ test_subqueries_ref(); /* outer reference in subqueries converted - Item_field -> Item_ref */ - test_union(); /* test union with prepared statements */ - test_bug3117(); /* BUG#3117: LAST_INSERT_ID() */ - test_join(); /* different kinds of join, BUG#2794 */ - test_selecttmp(); /* temporary table used in select execution */ - test_create_drop(); /* some table manipulation BUG#2811 */ - test_rename(); /* rename test */ - test_do_set(); /* DO & SET commands test BUG#3393 */ - test_multi(); /* test of multi delete & update */ + Item_field -> Item_ref */ + test_union(); /* test union with prepared statements */ + test_bug3117(); /* BUG#3117: LAST_INSERT_ID() */ + test_join(); /* different kinds of join, BUG#2794 */ + test_selecttmp(); /* temporary table used in select execution */ + test_create_drop(); /* some table manipulation BUG#2811 */ + test_rename(); /* rename test */ + test_do_set(); /* DO & SET commands test BUG#3393 */ + test_multi(); /* test of multi delete & update */ test_insert_select(); /* test INSERT ... SELECT */ test_bind_nagative(); /* bind negative to unsigned BUG#3223 */ - test_derived(); /* derived table with parameter BUG#3020 */ - test_xjoin(); /* complex join test */ + test_derived(); /* derived table with parameter BUG#3020 */ + test_xjoin(); /* complex join test */ test_bug3035(); /* inserts of INT32_MAX/UINT32_MAX */ - test_union2(); /* repeatable execution of union (Bug #3577) */ - test_bug1664(); /* test for bugs in mysql_stmt_send_long_data() + test_union2(); /* repeatable execution of union (Bug #3577) */ + test_bug1664(); /* test for bugs in mysql_stmt_send_long_data() call (Bug #1664) */ test_union_param(); - test_order_param(); /* ORDER BY with parameters in select list - (Bug #3686 */ + test_order_param(); /* ORDER BY with parameters in select list + (Bug #3686 */ test_ps_i18n(); /* test for i18n support in binary protocol */ test_bug3796(); /* test for select concat(?, ) */ + test_bug4026(); /* test microseconds precision of time types */ + /* + XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST + DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH. + */ end_time= time((time_t *)0); total_time+= difftime(end_time, start_time); - + /* End of tests */ } - + client_disconnect(); /* disconnect from server */ free_defaults(defaults_argv); print_test_output(); @@ -10262,3 +10180,4 @@ int main(int argc, char **argv) return(0); } +